首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Codeigniter-phpBB集成

Codeigniter-phpBB集成
EN

Stack Overflow用户
提问于 2012-11-06 13:48:01
回答 1查看 976关注 0票数 0

我已经尝试将phpBB论坛集成到Codeigniter项目中。我已经将codeigniter(phpbb library)提供的库放在了projectName/application/ library中,并将论坛放在了项目的根目录下。控制器看起来像这样:

代码语言:javascript
复制
<?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项目/)设置了适当的权限,错误显示为“找不到”的文件都在那里并且可以访问。请帮帮我。

以下是我试图访问控制器时出现的错误。

遇到PHP错误

严重性:警告

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

文件名: libraries/phpbb.php

行号: 32

遇到PHP错误

严重性:警告

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

文件名: libraries/phpbb.php

行号: 32

遇到PHP错误

严重性:警告

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

文件名: libraries/phpbb.php

行号: 33

遇到PHP错误

严重性:警告

消息: include():为包含(include_path='.:/usr/share/php:/usr/share/pear')打开'localhost/communityCI/community/config.php‘失败

文件名: libraries/phpbb.php

行号: 33

遇到PHP错误

严重性:警告

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

文件名: libraries/phpbb.php

行号: 34

遇到PHP错误

严重性:警告

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

文件名: libraries/phpbb.php

行号: 34

遇到PHP错误

严重性:警告

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

文件名: libraries/phpbb.php

行号: 35

遇到PHP错误

严重性:警告

消息: include():无法打开包含(include_path='.:/usr/share/php:/usr/share/pear')的'localhost/communityCI/community/includes/functions_display.php‘

文件名: libraries/phpbb.php

行号: 35

遇到PHP错误

严重性:警告

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

文件名: libraries/phpbb.php

行号: 36

遇到PHP错误

严重性:警告

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

文件名: libraries/phpbb.php

行号: 36

遇到PHP错误

严重性:警告

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

文件名: libraries/phpbb.php

行号: 37

遇到PHP错误

严重性:警告

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

文件名: libraries/phpbb.php

行号: 37

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-11-06 21:23:02

include(localhost/communityCI/community/common.php)

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

您不应该从URL使用include;它很可能不起作用(就像您在这里看到的那样),并且不是一个好的实践。

使用文件的相对或绝对路径执行include

代码语言:javascript
复制
include('/var/www/communityCI/community/common.php');

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13245146

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档