[英]Forward with request parameter in model/
有辦法向前邁進嗎
lib/model/doctrine/table.class.php?
我有一個查詢。 當查詢返回帶有$ input的假轉發時。 還是有另一種方法可以做到這一點。
謝謝!
貢納爾
不要在模型中執行此操作,而是在操作中執行以下操作:
action.class.php:
$result = Doctrine_Core::getTable('yourtable')->find(1234); // or any query
if (!$result) // check if the result is false / empty
{
$this->forward('default','notfound'); // specify your forwarding module/action
or
$this->forward404(); // default 404 error
}
您也可以在操作中使用:
$result = Doctrine_Core::getTable('yourtable')->find(1234); // or any query
$this->redirectIf(!$result, '@homepage');
要么
$this->redirect404If(!$result, 'Your message');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.