0

私の見解では、このコード行があります

<a href="<?php echo $this->url.'/login/calllogs/id/'.$record->phone_service_id;?>">Control Panel</a>

私のログインコントローラーには、このアクションがあります

public function calllogsAction(){
    if(!Zend_Auth::getInstance()->hasIdentity()){
        $this->_redirect('login/login');
    } else{
        $request = $this->getRequest();
        $this->view->assign('url', $request->getBaseURL());
    }
}

$record->phone_service_id;アクション ( ) でビュー変数 ( ) を取得するにはどうすればよいcalllogsActionですか? 私は送信していません。これは単なるリンクです。私のアクションcalllogsActionでこのようにすることはできないと思います

$request = $this->getRequest();
$phone_service_id =  $request->getParam("id");
4

2 に答える 2

1

結局のところ、最初の答えはあなたの試みと同じでした。

アドレスバーにIDを表示したくない場合(とにかく適切なツールがあれば、誰でも投稿データを見ることができることに注意してください)、他のオプションはフォームでPOSTを使用することです-

<form action="<?php echo $this->url.'/login/calllogs/id';?>" method="post">
<input type="hidden" name="id" value="<?php echo $record->phone_service_id; ?>" />
<input type="submit" name="submit" value="Control Panel" />
</form>

変数を取得するには、コントローラで getParam ではなく getPost を使用する必要があります。

于 2012-01-31T09:48:11.003 に答える
1

If you don't want the id to show in the address bar, then you will have to use POST. Use

<form method="post" action="<?php /*your URL here*/ ?>">

instead of a plain link, inside the form:

<input type="hidden" name="id" value="<?php /*your id here*/ ?>"/>

and in the controller use

$id = $this->getRequest()->getPost("id");
于 2012-01-31T10:07:41.973 に答える