donglie7778 2011-08-30 16:06
浏览 75
已采纳

htaccess中的php include_paths

I have a few things in various different files that get called from different places. I've been trying to use a $ROOT variable, but because I'm going from a few different files (index.php, view.php, admin/index.php etc) and don't have a bootstrap(or whatever that's called), I can't always get to $ROOT from things called by ajax etc..

if I set the include_path via htaccess somewhat like:

php_value include_path ".;C:\wamp\www\project\"

I assume that doesn't include subdirectories, and I would also have to add a line for each other directory where my files reside even if they're in C:\wamp\www\project\components or C:\wamp\www\project\model?

And do I add new lines or commas? I can't find any example online of using the htaccess to set include paths with multiple paths...

Alternately is there a way to get everything relating to my $ROOT variable and use absolute paths, and somehow have every file, even if they're in different places, reference that particular variable? (without having to make wholesale changes to all the files in the app?) That has the benefit of only needing to change on file in a server change/deployment, but I do not know how to start going about it!

thanks :)

  • 写回答

2条回答 默认 最新

  • doutuoben6908 2011-08-30 16:16
    关注

    I assume that doesn't include subdirectories,

    Why didn't you try it? (it does include sub dirs)

    I can't find any example online of using the htaccess to set include paths with multiple paths

    ? You've already provided one:

    php_value include_path ".;C:\wamp\www\project\"

    The paths are '.' and 'C:\wamp\www\project\'

    (BTW its better practice to use '/' as the dir seperator - it avoids confusion over unix style escaping)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型