Codeigniter+PhpBB function redeclaration

痴心易碎 提交于 2019-12-10 23:03:30

问题


I am trying to integrate phpbb to codeigniter. I don't want that the users register for the forum. Site login/register controllers should handle the forum part as well, so I am writing a ci library to register/login to phpbb.

I got an error because I have included phpbb functions and libraries inside my ci library:

Fatal error: Cannot redeclare redirect() (previously declared in E:\xampp\htdocs\ci\system\helpers\url_helper.php:535) in

Any idea how to solve this quickest way?

phpbb files that I have included inside my ci library are:

  • common.php
  • includes/functions_user.php
  • includes/functions_modul.php

回答1:


What I would do is just copy the PHPBB files to the CI application/ directory appropriately and then remove / rename the PHPBB functions as needed, while making them proper helpers or models.

The common.php file could probably find a home in application/helpers as phpbb_helper, and so on.

You obviously can not rename functions in the core PHPBB installation or it will break. Likewise, renaming common CI helper functions would be bad because it would break your ability to use sparks and other common libraries.

This isn't exactly 'quick', but should be workable in a couple of hours if you sat down determined to do it. And, you end up with decent reusable code that shouldn't be difficult to maintain so you never have to worry about it again.



来源:https://stackoverflow.com/questions/11168805/codeigniterphpbb-function-redeclaration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!