File1: {code...} File2: {code...} I tried this method and cannot call it. Does the static method not support dynamic calling? Is there another way to call it? File1:
// file1.phpnamespace Common\Model;class ArticleModel { static function save($id=0) { die('xxx'); }}
File2:
// file2namespace Admin\Controller;include('./file1.php');$model = 'ArticleModel';$call = "\\Common\\Model\\$model::save";$call(123123);
I tried this method and cannot call it.
Does the static method not support dynamic calling?
Is there another way to call it?
Reply content:
File1:
// file1.phpnamespace Common\Model;class ArticleModel { static function save($id=0) { die('xxx'); }}
File2:
// file2namespace Admin\Controller;include('./file1.php');$model = 'ArticleModel';$call = "\\Common\\Model\\$model::save";$call(123123);
I tried this method and cannot call it.
Does the static method not support dynamic calling?
Is there another way to call it?
namespace Admin\Controller; include('./file1.php'); $fqcn = '\\Common\\Model\\AritcleModel'; $func = 'save'; $fqcn::$func(123123);
$model = 'ArticleModel';$call = "\\Common\\Model\\{$model}";call_user_func_array(array($call, 'save'), array(123123));