2017-03-07 72 views
-2

如何解決以下錯誤:不能重新聲明Cpages :: edit_galleries_picture()

Fatal error: Cannot redeclare Cpages::edit_galleries_picture() in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\masterlinkci2\application\admin\controllers\Cpages.php on line 476

A PHP Error was encountered 

嚴重性:Compile Error

消息:Cannot redeclare Cpages::edit_galleries_picture()

文件名:controllers/Cpages.php

行號:476

回溯:

的網址:http://localhost/masterlinkci2/admin/index.php/cpages/edit_galleries_picture/21

行476:public function edit_galleries_picture() {

從評論

public function edit_galleries_picture() { 
    $gallery_id = $this->uri->segment(3); 
    $data['pictures'] = $this->Mpages->call_gallery_pictures($gallery_id); 
    $this->load->view('editgalleries', $data); 
} 
+1

發佈您的代碼.... – yogesh84

+0

行476: 公共職能edit_galleries_picture(){ \t \t \t \t $ gallery_id = $這個 - > URI->段(3); \t \t \t \t $ data ['pictures'] = $ this-> Mpages-> call_gallery_pictures($ gallery_id); \t \t \t \t $ this-> load-> view('editgalleries',$ data); \t \t \t} – David

+0

你的錯誤表明你已經聲明瞭公共函數edit_galleries_picture()兩次,這在php中是不可能的。請檢查,如果沒有找到,然後發佈您的控制器的完整代碼.. – yogesh84

回答

0

此錯誤顯示,因爲你已經擁有的功能edit_galleries_picture()在控制器Cpages

要解決此錯誤,請確保您沒有重複的功能。您可以將函數edit_galleries_picture()重命名爲不同的內容,也可以將代碼組合到一個函數中。