search
Homephp教程php手册php合并js请求的例子

php合并js请求的例子,直接看代码吧。

看代码就会的小例子:php合并js请求

复制代码 代码如下:


//页面保存为js.php
//前台请求范例?f=1,2
//请求1.js,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";
  }
 }
}
?>

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools