Example of php merge js requests. Let's take a look at the code. for example: php merging js requests to copy code Code: The page is saved as a js. php foreground request example localhostjs. php? F1, 2 request two files: 1.js, 2. js? A small example of php merging js requests.
The code is as follows:
// Save the page as js. php
// Front-end request example http: // localhost/js. php? F = 1, 2
// Request two files: 1.jsand 2. js.
Header ("Content-Type: application/x-javascript ");
Header ("Last-Modified:". gmdate ("D, d m y h: I: s"). "GMT ");
Header ("Cache-Control: max-age =". (86400*30 ));
Header ("Expires:". gmdate ("D, d m y h: I: s", time () + 86400*30). "GMT ");
If ($ _ GET ['F'])
{
$ Url = parse_url ($ _ SERVER ['request _ URI ']);
$ Arr_f = array_unique (explode (',', preg_replace ("/\. + \/", '', $ _ GET ['F']);
Foreach ($ arr_f as $ v)
{
If (! Empty ($ v ))
{
Include ('./'. $ v. '. js ');
Echo "\ n ";
}
}
}
?>
The response code is as follows: // The page is saved as js. php // frontend request example http: // localhost/js. php? F = 1, 2 // request two files: 1.js, 2. js? PH...