****php:require_once(dirname(__FILE__)."/./config_uc.php");

简介: Q:麻烦清楚地讲解一下这句的意思,具体路径是怎样的,这个文解在 根目录,如果我想放在根目录下的tieba文件夹里,应该怎么修改/./ 这个是表示什么?A: require_once(dirname(__FILE__).
Q:
麻烦清楚地讲解一下这句的意思,具体路径是怎样的,这个文解在 根目录,如果我想放在根目录下的tieba文件夹里,应该怎么修改
/./ 这个是表示什么?

A:
require_once(dirname(__FILE__)."/./config_uc.php");
一、__FILE__ php定义的为当前文件路径及文件名的常量,如: d:/wwwroot/dedecms/index.php
二、dirname(__FILE__) 为函数,取得文件路径的目录名;
echo dirname("d:/wwwroot/dedecms/index.php")结果为:d:/wwwroot/dedecms
三、require_once(dirname(__FILE__)."/./config_uc.php"); 假设当前文件为d:/wwwroot/dedecms/index.php结果为
require_once("d:/wwwroot/dedecms/config_uc.php");

另外/./config_uc.php 中./为当前目录

require_once(str_replace('/tieba','',dirname(__FILE__))."/./config_uc.php");


require_once(dirname(__FILE__)."/./config_uc.php");
require_once()表示引用文件,如果该文件中的代码已经被包括了,则不会再次包括
dirname() -- 返回路径中的目录部分
dirname(__FILE__) 得到的是文件所在层目录名
"/./config_uc.php" 这个就是文件路径了
/./应该是表示当前目录
/../可以表示上级目录

根目录下的tieba文件夹里
改:require_once(dirname(__FILE__)."/tieba/config_uc.php");
如何联系我:【万里虎】www.bravetiger.cn 【QQ】3396726884 (咨询问题100元起,帮助解决问题500元起) 【博客】http://www.cnblogs.com/kenshinobiy/
目录
相关文章
|
1月前
|
PHP
php 使用phpize报错Cannot find config.m4. Make sure that you run ‘/usr/bin/phpize‘ in the top l
php 使用phpize报错Cannot find config.m4. Make sure that you run ‘/usr/bin/phpize‘ in the top l
34 1
|
11天前
|
PHP
php+ajax传file文件数据
php+ajax传file文件数据
12 0
|
12天前
|
PHP 数据库
phpMyAdmin报错 in ./libraries/config/FormDisplay.php#661 continue targeting switch is equivalent to
phpMyAdmin报错 in ./libraries/config/FormDisplay.php#661 continue targeting switch is equivalent to
8 0
|
10月前
|
应用服务中间件 PHP nginx
PHP ERROR: Unable to create the PID file (/usr/var/run/php-fpm.pid).: No such file or directory (2)
PHP ERROR: Unable to create the PID file (/usr/var/run/php-fpm.pid).: No such file or directory (2)
187 1
原生php自定义表单(支持基本类型+file多文件上传)
原生php自定义表单(支持基本类型+file多文件上传)
原生php实现自定义表单(支持基本类型+file类型(单文件上传))
原生php实现自定义表单(支持基本类型+file类型(单文件上传))
|
10月前
|
应用服务中间件 PHP nginx
PHP ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory (2)
PHP ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory (2)
75 1
|
11月前
|
缓存 前端开发 PHP
PHP - Laravel The stream or file “/storage/logs/.“ could not be opened in append
PHP - Laravel The stream or file “/storage/logs/.“ could not be opened in append
438 0
|
12月前
|
安全 前端开发 PHP
layui框架实战案例(21):layui上传的哪些事(layui.upload组件、 file文件域、php后台上传)
layui框架实战案例(21):layui上传的哪些事(layui.upload组件、 file文件域、php后台上传)
686 0
|
测试技术 PHP
PHP: PhpStorm单元测试报错:PHPUnit Cannot open file
PHP: PhpStorm单元测试报错:PHPUnit Cannot open file
86 0