douchengchen7959 2013-11-07 16:55
浏览 29
已采纳

PHP包括在WAMP上解释为罚款但在远程服务器上被忽略

I have a static HTML header and footer included site wide via php include (php/navigation) and (php/footer.php) respectively.

The page interprets and includes all the of the above on WAMP with no errors (with either include or require) but when moved to my (LAMP) server the header and footer files are ignored (if i use require -- page displays nothing, so I know there is an error but I haven't been able to track it down)

other php includes in between the header and footer includes are read and displayed correctly and if i cut the the navigation.php and add it in place of the include it renders correctly -- but obviously i would rather avoid this approach.

  • 写回答

1条回答 默认 最新

  • duano3557 2013-11-07 17:01
    关注

    Try using the full file path. At the top of your file put this:

    define('ROOT', __DIR__ . '/', TRUE);
    

    Then when you want to call a file use:

    include ROOT . 'path/to/file.php';
    

    See if that helps.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭