Category: PHP 7.4
-
Post Views: 22 1. Reference:Install PHP, its version defaults to PHP 7.4 2. Uninstall PHP 7.4 and its dependencies first 3. Reference:How to install and run PHP 8.x on Ubuntu 20.04. Add the PHP PPA repository. Install PHP 8.1 using the following command. 4. Install PHP 8.1 successfully. as shown in Figure 1
-
Post Views: 23 1. Reference:The same CSS file (their ETags are equal), due to the difference in the response’s content-type, leads to the difference in the interface of the web page. Discover the response’s Content-Type based on MIME_CONTENT_TYPE – the MIME type of the detection file, and finally based on the MIME-TYPE detection LEAGUE/MIME-TYPE-detection League/mime-type-detection implementation. Detect according to content,…
-
Post Views: 18 1. The existing time field, its value is: 20231020105244000+0800, it can be known that its format in PHP is: ymdhisvo. Reference:https://www.php.net/manual/zh/datetime.format.php 2. Based on DateTime::CreateFromFormat — date_create_from_format – parse the time string according to the specified format. Print the returned DateTime object. as shown in Figure 1 3. Based on DateTimeInterface::Format — DateTimeImmutable::Format — DateTime::Format — Date_Format…
-
Post Views: 13 1. In Laravel 6, there is a simple implementation based on the judgment that the string contains ? 2. However, this implementation, some complex URIs are not considered. Example: ?d=3&e=5#6, will be replaced with: ?d=3&e=5#6&d=https://xxx.com. 3. The final decision is to add query parameters based on the League/URI, and execute the composer require League/uri-components and composer require…
-
Post Views: 15 1. The route of a requesting resource file is as follows: /static/xxx/9915995c-2952-4 90c-8e51-037a0950233c/assets/js/react.f886be.js 2. Since / is included in asset_key. Laravel routing components allow all characters except / . You must explicitly allow / to be part of a placeholder using the WHERE conditional regular expression. Otherwise, the route will fall back. The routes/web.php file is used…
-
Post Views: 16 1. Report an error in PHP 7.4: header() expects at least 1 parameter, 0 given. as shown in Figure 1 2. Check the specific code implementation 3. Print the $fields , the result is as follows 4. Add judgment, when $field is equal to name, print $FieldResolvers[$field], is_callable($fieldResolvers[$field]) 5. is_callable — Verify that the value can be…
-
Post Views: 15 1. In the MySQL table, the field type is JSON, and it is allowed to be null. as shown in Figure 1 2. Since only is_null() is judged in the program, if it is not null, the default is json format. When its value is String(4) “NULL”, the program throws a 500 exception. Displayed as null, indicating…
-
Post Views: 16 1. For the same GraphQL API request, it sometimes responds to 500 in the browser, and there is no response data, and sometimes the response is 200, and there is a response data. as shown in Figure 1 2. When the response is 500, there is no response data. Decide to set the error level to output…
-
Post Views: 25 1. Reference: In Laravel 6, based on ZipStream PHP, stream the zip file to the S3 bucket. Reference: Generate a stream resource based on Fopen in PHP 7.4, operate the disk, and adjust it to a memory-based implementation. The compression and decompression is successful based on 360, and the decompression based on WinRAR fails. as shown in…