Category: PHP
-
Post Views: 20 1. Check the existing implementation code as follows: 2. Check the print results before and after the multidimensional array index. Use the value of the name column in the array as the new key. as shown in Figure 1 3. However, just using the function array_column is enough to achieve. When column_key is null, the entire array…
-
Post Views: 16 1. When basename: “collections”, the decoding is successful. as shown in Figure 1 2. Decoding fails when basename: “CollectionTitem” is used. as shown in Figure 2 3. View the code implementation of the decoding 4. First analyze the successful process and print JSON_LAST_ERROR() 5. Re-analyze the failed process, print JSON_LAST_ERROR(), where the value of one failure is…
-
Post Views: 17 1. When using Redis with Laravel, there are two solutions, one is to install the phpredis php extension, and the other is to install the predis/predis package through composer. However, Predis has been abandoned by the original author of the package and may be removed from Laravel in future releases. It was finally decided to use the…
-
Post Views: 18 1. The existing array structure is as follows, and its key name is the form of lowercase letters and underscores. 2. It is expected to adjust the name of the array key to the hump form. The traditional way is to generate a new key in the form of a hump based on the foreach traversal. This…
-
Post Views: 19 1. When writing the automated test case of Lighthouse 5, split a test method into two test methods. The present stage is a method 2, split into two methods 3. Run the test and report an error: Error: Error: call to undefined method illuminate\support\facades\config::set(). as shown in Figure 1 4. At this time, if any of the…
-
Post Views: 16 1. Reference URL:https://lighthouse-php.com/4/testing/phpunit.html#setup, test with phpunit . In Lighthouse, it is easy to add automated tests with phpunit. 2. Run the GraphQL Query API and respond 200. The main test field: The responses of TheMeAssets. as shown in Figure 1 3. Edit /modules/themestore/tests/functional/graphql/onlineStoreEthemeGraphQLapTest.php, the code is as follows 4. Execute the command: ./vendor/bin/phpunit .\modules\themestore\tests\functional\graphql\OnlineStoreEthemeGraphQLapTest.php . Error: Failed…
-
Post Views: 15 1. The name of the table field is in the form of lowercase letters and underscores. as shown in Figure 1 2. The interface is implemented based on GraphQL, and the field name that is specified as the interface response must be in the form of hump. 3. Print the parser /modules/themestore/resolver/onlinestoreetheme/themeassesResolver.php method $themeAssets, the object property…