我在laravel / lumen中声明了一个路由组,如下所示:
$app->group(['middleware' => 'auth'], function () use ($app) {
$app->get('/details', 'UserController@details');
});
Run Code Online (Sandbox Code Playgroud)
路由文件web.php的所有内容如下:
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/
$app = app();
$router->get('/', function () use ($router) {
return $router->app->version();
});
$app->group(['middleware' => 'auth'], …Run Code Online (Sandbox Code Playgroud) 我有一个像这样的数组:
var arr = [[12,45,75], [54,45,2],[23,54,75,2]];
Run Code Online (Sandbox Code Playgroud)
我想找出嵌套数组中所有元素中最大的元素和最小的元素:
分钟应该是:2
和
马克斯应该是75
我尝试了下面的功能,但它们不起作用:
function Max(arrs)
{
if (!arrs || !arrs.length) return undefined;
let max = Math.max.apply(window, arrs[0]), m,
f = function(v){ return !isNaN(v); };
for (let i = 1, l = arrs.length; i<l; i++) {
if ((m = Math.max.apply(window, arrs[i].filter(f)))>max) max=m;
}
return max;
}
function Min(arrs)
{
if (!arrs || !arrs.length) return undefined;
let min = Math.min.apply(window, arrs[0]), m,
f = function(v){ return !isNaN(v); };
for (let i = 1, l …Run Code Online (Sandbox Code Playgroud) 使用以下行:
<div class="card light-blue darken-4" [ngClass]="'card-grad-'+Math.floor(Math.random() * 10) + 1">
Run Code Online (Sandbox Code Playgroud)
给出以下错误:
ERROR TypeError: Cannot read property 'floor' of undefined
Run Code Online (Sandbox Code Playgroud)
和component.ts。
怎么解决呢?
甚至尝试使用decare var Math:any,也尝试在类中定义数学,但徒劳无功。