假设我在我的路由中定义了一个资源:
Route::resource('account', 'AccountController', ['only'=> ['index','update']]);
Run Code Online (Sandbox Code Playgroud)
然后我从内部Middleware
附加到Controller
:
public function __construct() {
$this->middleware('BeforeAccount', ['only' => ['update']]);
}
Run Code Online (Sandbox Code Playgroud)
假设我想访问example.com/account/2
在我的中间件中的帐户(即)之后发生的 uri 参数- 我该如何获取该变量?
假设我在GHCI中声明了一个变量
let a = ["hello","goodbye","","sup","bye","hi","cat","dog"]
Run Code Online (Sandbox Code Playgroud)
我想从列表中删除那个讨厌的"".根据我的理解,我应该能够使用dropWhile这样做
dropWhile null a
Run Code Online (Sandbox Code Playgroud)
但这并没有消除讨厌的"".为什么是这样?我该如何解决这个问题?
啊,现在我明白了.我完全误解了dropWhile是如何工作的.那么为了使这个问题有所不同 - 如何删除列表中的空白条目?