这是检查变量是Smarty中特定类的对象的方法.
if( true eq isset($obj) && true eq is_object($obj) && $obj instanceof 'TestClass' ){
//do something
}
Run Code Online (Sandbox Code Playgroud)
这适用于 Smarty2 和 Smarty3:
{if $obj instanceof TestClass}
…
{/if}
Run Code Online (Sandbox Code Playgroud)