This is my directory structure:
classes
- myphpclass.php
controller
- controller.php
index.php
Now, I want to include myphpclass.php in my controller, but I don't know how to path it.
I'm trying something like include('classes/myphpclass.php');
But I can't make it to work
require_once(dirname(__FILE__).'/../classes/myphpclass.php'));
更好的使用require_once: require,include和require_once之间的区别?
使用正斜杠启动所有路径 - 然后它们都与ROOT相关。
include('/classes/myphpclass.php');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.