0

我曾尝试将 phpBB 论坛集成到 Codeigniter 项目中。我已将 codeigniter( phpbb library ) 提供的库放在 projectName/application/libraries 中,并将论坛放在项目的根目录下。控制器如下所示:

<?php
class Library_test extends CI_Controller
{
    function __construct()
    {
        parent::__construct();

        $this->load->database();
        $this->load->library('session');
        $this->load->library('phpbb_library');
    }

    function index()
    {
        if ($this->phpbb_library->isLoggedIn() === TRUE)
        {
            $userId = $this->phpbb_library->getUserInfo('user_id');
            $username = $this->phpbb_library->getUserInfo('username');

            echo "Welcome $username (" . ($this->phpbb_library->isAdministrator() === TRUE ? "administrator" : "user") . "), your ID is $userId and you are member of the following groups";

            foreach ($this->phpbb_library->getUserGroupMembership() as $group)
            {
                echo "$group <br />";
            }
        }
        else
        {
            echo "You are not logged-in.";
        }
    }
}
?>

我已经为整个项目(chmod -R 777 project/)设置了适当的权限,并且错误显示为“未找到”的文件在那里并且可以访问。请帮帮我。

以下是我尝试访问控制器时的错误。

遇到 PHP 错误

严重性:警告

消息:包括(localhost/communityCI/community/common.php):无法打开流:没有这样的文件或目录

文件名:库/phpbb.php

行号:32

遇到 PHP 错误

严重性:警告

消息:include():无法打开“localhost/communityCI/community/common.php”以包含(include_path='.:/usr/share/php:/usr/share/pear')

文件名:库/phpbb.php

行号:32

遇到 PHP 错误

严重性:警告

消息:包括(localhost/communityCI/community/config.php):无法打开流:没有这样的文件或目录

文件名:库/phpbb.php

行号:33

遇到 PHP 错误

严重性:警告

消息:include(): 未能打开 'localhost/communityCI/community/config.php' 以包含 (include_path='.:/usr/share/php:/usr/share/pear')

文件名:库/phpbb.php

行号:33

遇到 PHP 错误

严重性:警告

消息:包括(localhost/communityCI/community/includes/functions_user.php):无法打开流:没有这样的文件或目录

文件名:库/phpbb.php

行号:34

遇到 PHP 错误

严重性:警告

消息:include():无法打开“localhost/communityCI/community/includes/functions_user.php”以包含(include_path='.:/usr/share/php:/usr/share/pear')

文件名:库/phpbb.php

行号:34

遇到 PHP 错误

严重性:警告

消息:包括(localhost/communityCI/community/includes/functions_display.php):无法打开流:没有这样的文件或目录

文件名:库/phpbb.php

行号:35

遇到 PHP 错误

严重性:警告

消息:include(): 未能打开 'localhost/communityCI/community/includes/functions_display.php' 以包含 (include_path='.:/usr/share/php:/usr/share/pear')

文件名:库/phpbb.php

行号:35

遇到 PHP 错误

严重性:警告

消息:include(localhost/communityCI/community/includes/functions_privmsgs.php):无法打开流:没有这样的文件或目录

文件名:库/phpbb.php

行号:36

遇到 PHP 错误

严重性:警告

消息:include():无法打开“localhost/communityCI/community/includes/functions_privmsgs.php”以包含(include_path='.:/usr/share/php:/usr/share/pear')

文件名:库/phpbb.php

行号:36

遇到 PHP 错误

严重性:警告

消息:包括(localhost/communityCI/community/includes/functions_posting.php):无法打开流:没有这样的文件或目录

文件名:库/phpbb.php

行号:37

遇到 PHP 错误

严重性:警告

消息:include():无法打开“localhost/communityCI/community/includes/functions_posting.php”以包含(include_path='.:/usr/share/php:/usr/share/pear')

文件名:库/phpbb.php

行号:37

致命错误:在第 39 行的 /var/www/communityCI/application/libraries/phpbb.php 中的非对象上调用成员函数 session_begin()

4

1 回答 1

1

包括(localhost/communityCI/community/common.php)

/var/www/communityCI/application/libraries/phpbb.php

你不应该include来自一个 URL;它很可能不起作用(就像你在这里看到的那样)并且不是好的做法。

include使用文件的相对或绝对路径执行您的 's:

include('/var/www/communityCI/community/common.php');

你也不应该chmod 0777整个项目......

于 2012-11-06T13:23:02.353 回答