Code: 1 /* 判断是否引入了公共文件demo.php */ 2 $include_files = get_included_files(); 3 $include_files_exist = 0 ; 4 foreach($include_files as $include_files_val){ 5 if(strpos($include_files_val,'demo.php') !== false ){ 6 $incl
Code:
1 /* 判断是否引入了公共文件demo.php */2 $include_files = get_included_files();
3 $include_files_exist = 0 ;
4 foreach($include_files as $include_files_val){
5 if(strpos($include_files_val,'demo.php') !== false ){
6 $include_files_exist = 1;
7 }
8 }
9 if($include_files_exist != 1){
10 include_once('demo.php');
11 }
Command:
get_included_files();strpos()
include_once();
其实,当时是因为重复引入同一文件引起报错,解决办法很简单,直接改为include_once() 或 require_once() 就OK。