问题
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