php中php.ini遇到的问题

WBOY
Release: 2016-06-23 13:51:37
Original
858 people have browsed it

我在php.ini中配置了include_path的路径(有unix和windows我win7的系统配置了windows下的),在php使用include时,在配置的路径下的文件却说找不到,还是得用绝对路径,或者放在在同一级的文件夹下。


回复讨论(解决方案)

include_path表示include命令引用某个文件的路径,设置了这个值之后,就可以在php代码中写相对路径导入某个文件。在windows下,比如说,include_path为“c:\code\php”,include命令写成include=“file1.php”,这样导入的文件的真正路径是“c:\code\php\file1.php”。

目???
include/function.php
www/index.php

function.php

<?phpfunction test(){    echo 'Hello World';}?>
Copy after login


index.php include function.php
<?phpinclude "../include/function.php";test();?>
Copy after login

include_path表示include命令引用某个文件的路径,设置了这个值之后,就可以在php代码中写相对路径导入某个文件。在windows下,比如说,include_path为“c:\code\php”,include命令写成include=“file1.php”,这样导入的文件的真正路径是“c:\code\php\file1.php”。

是的。。。找到问题了,是我太马虎,php.ini中注释掉了没注意。解开后确实是这样。今天老大和我说在ini中配置include_path被建议最好别开,每次include,require都去查找那个路径很不好,自己设置一个路径常量用比较好,是这样吗?
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template