Heim  >  Artikel  >  Backend-Entwicklung  >  php中set_include_path与get_include_path例子

php中set_include_path与get_include_path例子

WBOY
WBOYOriginal
2016-07-25 09:05:51767Durchsuche
  1. set_include_path('/xampp/htdocs/test/include');  //请注意php里边的'/'代表的不是网站根目录,而是文件所在的盘符,可用echo realpath('/');查看

  2. //若php版本过低,该函数不支持,可用通用版ini_set()
  3. /*查看真实默认包含路径*/

  4. echo realpath(get_include_path());
  5. /*要包含cls.mysqli.php只需要*/
  6. require_once('cls.mysqli.php');
  7. $mysql = new Mysql('localhost','root','','test');  //实例化和之后的查询语句并无错误
复制代码


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn