<?php if (function_exists (' date_default_timezone_set ')) {date_default_timezone_set (' PRC ');} function a () {$time = Time (); Sleep (3); $fp = fopen (' result_a '. $time. Log ', ' W '); Fputs ($fp, ' Set in '. Date (' h:i:s ', time ()). (double) Microtime (). "rn"); Fclose ($fp); Function B () {$time = time (); sleep (3); $fp = fopen (' result_b '. $time. Log ', ' W '); Fputs ($fp, ' Set in '. Date (' h:i:s ', time ()). (double) Microtime (). "rn"); Fclose ($fp); } If (!isset ($_get[' Act ')) $_get[' act '] = ' a '; If ($_get[' act ') = = ' a ') {a ();} else if ($_get[' act '] = = ' B ') b ();?>
The above code, writes a file locally.
If you access localhost/a.php in two browser tags as soon as possible while opening, found two file creation time difference is 3 seconds
But if you visit localhost/a.php?act=b another access/a.php?act=a you find that two files were created almost the same time.
For apache, the same URL means a thread (we or a process), but a different URL means it can be concurrent.
If there is a download action inside PHP
function Runthread () {down ("http://localhost/test/a.php?act=a"),} if ($_get[' act ' = = ' run ') {echo ' start: '; runthread ( ); Echo ' End '; }
Http://localhost/test/a.php?act=run
http://localhost/test/a.php?act=run&s=2
As long as the URL of the primary access is different, it is considered to be different, which means concurrency. File creation time is not 3 seconds
A friend with a local Linux server can also use Linux to simulate concurrency
<?php for ($i =0; $i <10; $i + +) {echo $i; sleep (5);}?>
Save it as test.php, and then write a shell code
#!/bin/bash
For I in 1 2 3 4 5 6 7 8 9 10
Do
Php-q test.php &
Done
Fixed a bug where:d oc: ' Image manipulation Library <libraries/image_lib> ' didn ' t escape Image source paths passed to ImageMagick as Shell Arguments.
Fixed a bug (#861)-:d oc: ' Database Forge <database/forge> ' method create_table () incorrectly accepts field width co Nstraints for Mssql/sqlsrv Integer-type columns.
Fixed a bug (#4562)-:d oc: ' Cache Library <libraries/caching> ' didn ' t check if Memcached::quit () is available before Calling it.
Fixed a bug (#4563)-:d oc: ' Input Library <libraries/input> ' method request_headers () ignores $xss _clean parameter V Alue after first Call.
Fixed a bug (#4605)-:d oc: ' Config Library <libraries/config> ' method Site_url () stripped trailing slashes from rela tive URIs passed to it.
Fixed a bug (#4613)-:d oc: ' Email Library <libraries/config> ' failed to send multiple emails via SMTP due to ' alread Y authenticated "errors when keep-alive is Enabled.
Fixed a bug (#4633)-:d oc: ' Form Validation Library <libraries/form_validation> ' ignored multiple ' callback ' rules F or empty, non-required fields.
Fixed a bug (#4637)-:d oc: ' Database <database/index> ' method error () returned FALSE with the ' oci8 ' driver if there was no Error.
Fixed a bug (#4647)-:d oc: ' Query Builder <database/query_builder> ' method count_all_results () doesn ' t take into ACC Ount GROUP by clauses and deciding whether to do a subquery or Not.
Fixed a bug where
How PHP supports multithreading concurrency