2012-07-17 28 views
4

我試圖將一個字符串傳遞給requestaction。在CakePHP中向requestAction傳遞斜槓參數

public function myAction($name) { 
    $data = unserialize(file_get_contents($name)); 
    return $data; 
} 
在我瀏覽文件

myController的文件

$f="/home/myaccount/file.txt"; 

$g = $this->requestAction(array('controller' => 'myController', 
     'action' => 'myAction'), $f); 

我怎樣才能使具有特殊字符的說法?

回答

3

希望下面的代碼將幫助您:

$g = $this->requestAction('/myController/myAction', array('pass' => urlencode($f)); 

This link將指導您如何訪問您的控制器的動作參數。

0

正確的解決方法是:

$g = $this->requestAction('app/myController/'.urlencode($f)); 
相關問題