来自温和来源的 PHP 注释脚本在 000webhost 免费服务器上不起作用


php comment script from gentle source not working on 000webhost free server

Index.php

<?php include './include.php'; ?>
<html> Page data
<?php echo $c5t_output; ?>
 </html>

包括.php

<?php
    /** 
     * GentleSource Comment Script
     * 
     */
    define('C5T_ROOT', '/comment_script_2.1.2/');
    include C5T_ROOT . 'comment.php'; 

    ?>

当我在页面上加载脚本时,我在免费服务器上 000webhost.com 收到以下错误.php但它在我的本地 xampp 服务器上运行良好,即使文件位于正确的位置,文件名正确。

警告:include() [function.include]:打开"/comment_script_2.1.2/comment.php"以包含(include_path='.:/usr/lib/php:/usr/local/lib/php') 在/home/a5962782/public_html/include.php 第 9 行

来自: http://php.net/manual/en/function.include.php

如果定义了路径 - 无论是绝对路径(在Windows上以驱动器号或''开头,在Unix/Linux系统上以/开头)还是相对于当前目录(以.或..开头),则include_path将被完全忽略。例如,如果文件名以 .. 开头。/,解析器将在父目录中查找请求的文件。

您已在包含中定义了绝对路径。删除/它应该可以工作。

define('C5T_ROOT', 'comment_script_2.1.2/');
include C5T_ROOT . 'comment.php'; 

这将使包含外观出现在包含路径中,其中包含当前目录 (.)。所以./comment_script_2.1.2/comment.php将被拾取。