【发布时间】:2013-08-22 02:52:27
【问题描述】:
我有一个类,其中包含一个名为“ControllerUtility”的插件类中的名为 hash 的静态方法
函数位于ControllerUtility/Model/ControllerUtility.php
public static function hash( $string )
{
return hash( 'sha256' , $string );
}
如何在模型或控制器中以静态方式调用此方法,我不想将此类加载到 $this 中,因为这会给我一个对象的实例。
我想打电话
ControllerUtility::hash( "string );
而不是将函数更改为非静态函数然后调用
$this->ControllerUtility->hash( "string );`
在我的控制器中
【问题讨论】:
-
I want to call ControllerUtility::hash( "string" );- 这就是答案。
标签: php cakephp plugins static load