dongle7637 2015-12-10 18:09
浏览 51

PHP包含路径不适用于OS X.

So ever since I got my Mac including files with PHP

Warning: include(Applications/XAMPP/xamppfiles/htdocs/social/include/core.php): failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/social/index.php on line 1

This is my php include:

<?php include("Applications/XAMPP/xamppfiles/htdocs/social/include/core.php") ?>

Any suggestions?

  • 写回答

1条回答 默认 最新

  • douji4223 2015-12-10 18:14
    关注

    You simply forgot the starting slash /, so your code tries to include the file relative to your script.

    You can try this include:

    include("/Applications/XAMPP/xamppfiles/htdocs/social/include/core.php")
    

    What also can be helpful, is using __DIR__ or the dirname() function.

    评论

报告相同问题?