Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Wednesday, March 24, 2010

[PHP] 設定script執行時間限制

set_time_limit(0);

Friday, March 19, 2010

[CakePHP] 元件重複利用

靜態頁面


echo $this->renderElement('blah');


動態內容頁面

requestAction

requestAction(string $url, array $options)
You can use requestAction() to retrieve a fully rendered view by passing 'return' in the options: requestAction($url, array('return'));


array based cake style url

$this->requestAction(array('controller' => 'articles', 'action' => 'featured'), array('return'));

This allows the requestAction call to bypass the usage of Router::url which can increase performance.



測試結果只有 $options有給 return才有效,沒給return都是no return (another cake bug??)

[CakePHP] constant & variable

本機目錄
WWW     (...user2/app/webroot)
IMAGES  (...user2/app/webroot/img)
...etc

給url使用
$this->webroot  (/users2/app/webroot/)

[PHP] debug

倒出變數的function

var_dump($var)
var_export($var)   字串為php code
print_r($var)