Category: PHP
-
Post Views: 17 1. In Laravel 6, ThemeInstallation::IscodeEdited must return a relationship instance.. as shown in Figure 1 2. View the method in the model file 3. Finally found the reason, $theme->ThemeInstallation->iscodeEdited needs to add ()
-
Post Views: 19 1. In PHP 7.4, when using file_put_contents, an error is reported: Failed to open stream: no such file or directory. as shown in Figure 1 2. The reason is the file name: theme-cdn-config-2023-02-23-10:23:19.txt format is incorrect, it contains :, replace : with -, run again, no errors are reported.
-
Post Views: 20 1. In the container, when the environment variable is obtained for the first time, the configuration value of the production environment is obtained, or it is not obtained (set in the program, when the environment variable is not set, the default setting is the configuration value of the production environment). When the environment variable is obtained for…
-
Post Views: 13 1. Now there is a string with the following contents 2. It is expected to batch replace the default in the string to basic 3. Refer to the str::replaceArray function to replace the given value in the string using the array order 4. Since there is only one element in the array $replace, only one default is…
-
Post Views: 16 1. Report an error in PHP 7.4: Cannot RedeClare GetFirstSkuIndex(). Indicates that the function getFirstSkuIndex() has been defined. PHP does not support redefining declared functions. as shown in Figure 1 2. Reference:https://www.shuijingwanwq.com/2022/11/14/7149/, now because the same file is repeatedly introduced (re-introduced on business). This leads to the same function being duplicated. 3. View the code implementation of…
-
Post Views: 62 1. Generate a new module: blog. 2. By default, the module class will not load automatically. You can load your modules automatically using PSR-4. Edit composer.json. as shown in Figure 1 3. Tip: Don’t forget to run composer dump-autoload. as shown in Figure 2 4. Generate a given console command for the specified module. 5. Edit CreatePostCommand.php,…
-
Post Views: 16 1. Reference: Run the .sh or shell script files in WSL in Windows 10. Since the .sh file is run, all environment configurations in the file must depend on the configuration items in Ubuntu. But the environment configuration in Ubuntu is not perfect. Decided to replace the shell script with php script 2. The code implementation of…