0
我想從zend控制器indexAction調用一個javascript函數。我的控制器看起來像這樣..如何從zend控制器indexAction調用JavaScript函數?
// mycontroller.php
public function indexAction(){
$role = 'admin';
$id = 23;
// here i want to call the javascript function
/// like myjsfun(role, id);
}
和viwefile的控制器 //index.phtml
here is my javascript function
<script type='text/javascript'>
function myjsfun(role, id){
// code for this function
}
謝謝..我可以調用控制器內的函數,如 –
否。語法不正確(PHP變量需要'$'),並且您沒有變量'$ role'和'$ id'。我提出的代碼有什麼問題? – bububaba