我知道這個問題已經被回答了很多次,但是我有一些問題我無法修復。
我收到了幾條關於在特定頁面和特定行上分配返回值的警告。但是,當我OPET該頁面,無論是請求的線是空的,下面的評論或別的東西.. 這裏是一個警告,網頁代碼與它去:棄用:通過引用分配新的返回值在代碼的空行上被棄用
Deprecated: Assigning the return value of new by reference is deprecated in /home/saltushr/public_html/_classes/hr/dimedia/framework/Controller.class.php on line 25
Deprecated: Assigning the return value of new by reference is deprecated in /home/saltushr/public_html/_classes/hr/dimedia/framework/Controller.class.php on line 26
和代碼是:
<?php
/**
* This clas instantiates the required {@link Model} and {@link View} objects.
*
* @author Berislav Lopac [email protected]
* @version 1.0
*/
class Controller {
var $model;
var $view;
/**
* The constructor.
* Instantiates the {@link Model} and {@link View} objects.
*
* @param $_task A String setting the base name of the instantiated objects.
* @param $_db ADOConnection object containing the connection to the database.
* @param $_input An Array with the input values required by the Model (usually the $_REQUEST array).
*/
function &Controller($_name, &$_db, $_input) {
$model = $_name . "Model";
$view = $_name . "View";
$this->model =& new $model($_db, $_input);
$this->view =& new $view($this->model);
}
/**
* Returns the associated {@link View} object.
* @return View
*/
function &getView() {
return $this->view;
}
}
?>
你可以看到,線25和26都是空的:
21 var $model;
22
23 var $view;
24
25
26
27 /**
誰能幫助我明白這是什麼一回事呢?我在理解PHP方面很新,可以使用一些幫助。 謝謝。
哦,我在格式化代碼後搞砸了行號引用......但是很多空行都很糟糕。 –
在使用參考資料之前,您應該閱讀本手冊:http://php.net/references – Daniel
我知道,問題在於此代碼不是我的..我只是想刪除已棄用的警告。我完成了3頁,但這是一個竊聽我。 @Felix Kling,刪除空行,我會盡早做到這一點。只有一個問題,當我改變我得到的代碼時: 解析錯誤:語法錯誤,意外的T_CLASS位於/home/saltushr/public_html/_classes/hr/dimedia/framework/Controller.class.php第1行 ...即使當我只複製上面的代碼沒有額外的空行.. – ecoLogic