Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在Laravel宏闭包中记录$this?_Php_Laravel_Closures_Documentation_Phpdocumentor2 - Fatal编程技术网

Php 如何在Laravel宏闭包中记录$this?

Php 如何在Laravel宏闭包中记录$this?,php,laravel,closures,documentation,phpdocumentor2,Php,Laravel,Closures,Documentation,Phpdocumentor2,假设我在包服务提供商中注册了一个宏,并且正在为包编写文档 \Laravel\dash\Browser::宏('scrollToElement',函数($element=null){ $this->script($('html,body').animate({scrollTop:$('$element').offset().top},0);”; 退还$this; }); 现在,如何在闭包中记录变量$this 在哪方面?\Laravel\dash\Browser正常。你在挣扎什么?它是如何解释此上

假设我在包服务提供商中注册了一个,并且正在为包编写文档

\Laravel\dash\Browser::宏('scrollToElement',函数($element=null){
$this->script($('html,body').animate({scrollTop:$('$element').offset().top},0);”;
退还$this;
});

现在,如何在闭包中记录变量
$this

在哪方面?
\Laravel\dash\Browser
正常。你在挣扎什么?它是如何解释此上下文中$this实际上是什么,还是解释它是如何工作的?如何解释此上下文中$this是什么。在什么方面?
\Laravel\dash\Browser
确定。你在挣扎什么?它是如何解释此上下文中的
$this
实际上是什么,还是解释它是如何工作的?如何解释此上下文中的$this。