织梦CMS - 轻松建站从此开始!

欧博ABG官网-欧博官方网址-会员登入

欧博官网defining directory path using realpath() funct

时间:2025-08-25 19:21来源: 作者:admin 点击: 19 次
I need to define a few directory paths for an application. The folder setting The config.php is in the config folder which is placed outside the ro

I need to define a few directory paths for an application.

The folder setting

The config.php is in the config folder which is placed outside the root directory (best practice, read somewhere). The application is placed in the root directory (myCms, in this case). Right now I am on a local server (xampp).

enter image description here

The config.php has some configuration and few credentials as required by the program to function.

As said, I need to define a few directories (images, template, system so on and so forth) in the config.php file. I previously defined them as

define('DIRIMAGES','C:/xampp/htdocs/myCms/images/', false);

I was planning to use the realpath() function to get the job done and tried this

define('DIRIMAGES', str_replace('\\', '/',realpath(dirname(__FILE__))).'/images/', false);

Later I included the config.php in the index.php (index.php in myCms folder) and echoed to check the path of the directory and it shows

C:/xampp/htdocs/config/system/

Where as I was looking for:

C:/xampp/htdocs/myCms/system/

Can you suggest or help?

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-09-08 23:09 最后登录:2025-09-08 23:09
栏目列表
推荐内容