0

I have installed grocery_crud into my existing CI v1.7 app, files/pages connects to db and loads fine, however when I click on the edit button, I get this error:

Fatal error: Cannot redeclare class Fatal error: Cannot redeclare class Error in /home/wallace/public_html/wallacep/controllers/wallace/error.php on line 6

I then noticed that the url of the edit button is: http://dev1.wallacep.stag/index.php/main/edit/2 it is retaining the index.php. Now this is a legacy CodeIgniter app, so I can't mess around with the .htaccess file. The config.php file has a base reference similar to this:

$config['base_url'] = 'http://' . trim($_SERVER['SERVER_NAME'], '/') . '/';

and the index file section still points to this: $config['index_page'] = "index.php";

I adjusted this line, changing it to:$config['index_page'] = "";

but I still get this: Fatal error: Cannot redeclare class Error in /home/wallace/public_html/wallacep/controllers/wallace/error.php on line 6

Also, since this is a legacy application, I am concerned what issues in other places in the site the removal of the index.php has caused that I am not aware of yet.

I went to the error.php page mentioned and all it has is this:

class Error extends Base_Error {

}

Can anyone point me in the right direction for fixing this issue within grocery_crud?

Thank you.

4

1 回答 1

0

There is already a class in scope called Error, You can not have 2 class names called the same thing

You will need to rename the old or the new class to continue

Edit:

to help find it

$reflector = new ReflectionClass('Error');
echo $reflector->getFileName();
echo $reflector->getStartLine();

That should give you the file and the line

于 2013-07-29T15:51:50.437 回答