Category: Programming Language
-
Post Views: 16 1. In PHP, replace some sensitive characters in a string based on preg_replace. One problem that exists is that in its format, a certain string may not exist. Example as follows 2. Why exist the above 3 formats, the reason is that it is generated based on the following code 3. The final code is as follows…
-
Post Views: 18 1. Error:[2024-09-28 02:59:09]local.error: preg_replace(): unknown modifier�{“exception”:”[object](ErrorException(code: 0): preg_replace(): unknown modifier�at) [stacktrace]. as shown in Figure 1 2. Check the code implementation 3. View the printed log information 4. The cause is initially derived, the value of the variable $otherpattern is “province/state caused by “/” caused by “/”. Reference:Regular expression special characters are: . \ + * ?[…
-
Post Views: 17 1. In Spatie\QueryBuilder , the request parameter contains “,” error: sqlstate[HY093]: Invalid parameter number: number of bound variables not match number of tokens (SQL: select count(*) as aggregate from `table` where `table`.`Shipping_type` = 2 and `Shipping_at_gmt` >= 2024-05-21 08:54:14 and `Shipping_at_gmt` <= 2024-08-21 08:54:14 and `table`.`Shipping_error_message in (AAA)). as shown in Figure 1 2. When the request…
-
Post Views: 20 1. Modify the PHP implementation of the table field type 2. However, in Navicat for MySQL, check that there is no change in DDL. Even after closing the connection and closing the database, it is opened again, and it is found that there is still no change. Finally had to close Navicat for MySQL and open it…
-
Post Views: 17 1. Verify the fields that conform to the MySQL field type Decimal(8,2) in Lavavel 9. as shown in Figure 1 2. The final realization is as follows 3. Try respectively: -4 (fail), 0 (success), 5 (success), 999999.99 (success), 999999.990 (success), 999999 .991 (failed), 9999990.99 (fail), 0.09 (success), 0.009 (fail), 0.0000001 (failed), in line with expectations. as shown…
-
Post Views: 20 1. In MySQL 8, the IN condition is used for multiple fields, and the query result is empty. as shown in Figure 1 2. Reference:In MySQL 8, the in condition is used for multiple fields The query result is not empty for sql as follows 3. Reference:Error when using native expression query in Laravel 9: SQLState[42000]: syntax…
-
Post Views: 20 1. The format of the excel file exported now, the format of the operation time column is regular. as shown in Figure 1 2. You need to set the operation time column to the date time format. Reference: InsertDate method can only format a specific cell. Now plan to execute the insertDate method after every 10 rows…
-
Post Views: 15 1. There is no primary key ID of the A table in the B table, but there are 2 other fields of the A table. Now plan to query the records in the A table based on the other 2 fields of the A table. Plan to use in conditions. The general standard usage is shown below…
-
Post Views: 63 1. Error: class “vtifulkernelexcel” not found. 2. The reason is that the extension php-ext-xlswriter is not installed. 3. GitHub Release: https://github.com/viest/php-ext-xlswriter/releases download php-windows-xlswriter-cf7e1933-8.1-ts-vs16-x64.zip. as shown in Figure 1 4. After decompression, copy php_xlswriter.dll to C:php-8.1.27extphp_xlswriter.dll 5. Edit php.ini, add extension=xlswriter 6. After restarting php, the error is reported again:[ERROR]workbook_close(): error creatingE:WWWRootObjectStorageAppExport/Order/Order Export Task 2024-02-19 10:24:06.xls. error =…
-
Post Views: 15 1. In Laravel 9, after executing redis::set($this->rules_update_key, carbon::now()); and found that the written value is Object. as shown in Figure 1 2. But in the test environment, the written value is a datetime string. Its value: 2024-01-30 06:00:00. as shown in Figure 2 3. The final comparison found that the root of the difference is that in…