Home >Backend Development >PHP Tutorial >php中php.ini遇到的有关问题

php中php.ini遇到的有关问题

WBOY
WBOYOriginal
2016-06-13 12:04:47823browse

php中php.ini遇到的问题
我在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

<br /><?php<br />function test(){<br />    echo 'Hello World';<br />}<br />?><br />


index.php include function.php
<br /><?php<br />include "../include/function.php";<br />test();<br />?><br />

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