php使用 set_include_path

通过set_include_path引用home/lib/image.func.php

1.创建include.php

2.添加如下代码

3.在需要引用的文件中包含include.php文件

<?php
session_start();
define("ROOT",  dirname(__FILE__));
set_include_path(".".PATH_SEPARATOR.ROOT."/lib".PATH_SEPARATOR.ROOT."/core".PATH_SEPARATOR.get_include_path());
 require_once'mysql.func.php';
require_once'image.func.php';
require_once'common.func.php';
 require_once'image.func.php';
?>

  

php使用 set_include_path_第1张图片

包含inclde.php 文件后无法正常运行

原因是因为两次使用了session_start();

php使用 set_include_path_第2张图片

你可能感兴趣的:(include)