这些脑筋急转弯是什么意思,在哪里可以读到更多
return $container->{$resource};发布于 2010-02-20 22:49:53
有两种可能性:
$resource = "score";//动态设置名称
返回$container->{$resource};//同返回容器/初学者错误
程序员想要输入:
return $container->resource; // returns resource public member variable发布于 2010-02-20 22:51:58
括号用于使用变量变量。这样可以更容易地区分以下各项:
// gets the value of the "resource" member from the container object
$container->resource;和
// gets the value of the "foo" member from the container object
$resource = 'foo';
$container->$resource;你可以在这里阅读更多内容:http://php.net/manual/en/language.variables.variable.php
https://stackoverflow.com/questions/2302531
复制相似问题