我正在查看 Laravel 代码并在 Authenticate.php 中间件中找到了这个:
public function handle($request, Closure $next, ...$guards)
{
$this->authenticate($guards);
return $next($request);
}
Run Code Online (Sandbox Code Playgroud)
没见过这种东西,3点有什么作用?我用谷歌搜索但什么也没找到
我正在学习本教程.我目前正在使用laravel 5.3,所以它有点过时了.我按照教程的说法一步一步地完成了,但是,我得到了
ReflectionException in Container.php line 749:
Class First does not exist
in Container.php line 749
at ReflectionClass->__construct('First') in Container.php line 749
at Container->build('First', array()) in Container.php line 644
at Container->make('First', array()) in Application.php line 709
at Application->make('First') in Kernel.php line 173
at Kernel->terminate(object(Request), object(Response)) in index.php line 58
at require_once('C:\xampp5\htdocs\laravel\laravel\public\index.php') in server.php line 21
Run Code Online (Sandbox Code Playgroud)
一切都像在教程中一样.我不知道问题出在哪里.
我有一个非常标准的表单来提交图像:
<form enctype="multipart/form-data" class="form-horizontal" role="form" method="POST">
<input id="image" name="image" type="file"/>
</form>
Run Code Online (Sandbox Code Playgroud)
我希望能够将图像拖动到某个区域,以便将其选为输入。
我已经在互联网上研究过如何完成如此简单的任务,但我只得到了使用 AJAX 的过度插件,遗憾的是这不是此表单的选项。任何人都知道如何做到这一点?
我收到此错误:
查看未找到[layouts.master].(查看:C:\ xampp5\htdocs\laravel\laravel\resources\views\page.blade.php)
这是我的master.blade.php:
<html>
<head>
<title>@yield('title')</title>
</head>
<body>
@section('sidebar')
This is the master sidebar.
@show
<div class = "container">
@yield('content')
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是page.blade.php:
@extends('layouts.master')
@section('title', 'Page Title')
@section('sidebar')
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
<h2>{{$name}}</h2>
<p>This is my body content.</p>
@endsection
Run Code Online (Sandbox Code Playgroud)
以下是路线的相关部分:
Route::get('blade', function () {
return view('page',array('name' => 'Random Name'));
});
Run Code Online (Sandbox Code Playgroud) 我有一个动态生成的表单,给我一个输入数组.但是数组可能是空的,那么foreach将失败.
public function myfunction(Request $request)
{
if(isset($request))
{
#do something
}
}
Run Code Online (Sandbox Code Playgroud)
这显然不起作用,因为它是$ request对象并且始终设置.我不知道如何检查是否有任何输入.
有任何想法吗?
我正在尝试在Laravel中设置调度程序.
这是我的crontab,我调试并正常工作 - 至少我的cron工作
* * * * * /bin/echo "foobar" >> /my_path/example.txt
Run Code Online (Sandbox Code Playgroud)
我不知道这个是否有效:
* * * * * php /var/www/myproject/artisan schedule:run 1>> /dev/null 2>&1
Run Code Online (Sandbox Code Playgroud)
这是我在内核中的日程安排功能:
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')
->everyMinute();
}
Run Code Online (Sandbox Code Playgroud)
当我在我的项目中尝试php artisan inspire它实际上是有效的,所以我希望它每分钟都会发射,但它不会做任何事情.什么都没发生.
有任何想法吗?
我正在尝试使用以下命令安装Archive :: Zip:
cpan[3]> install Archive::Zip
Run Code Online (Sandbox Code Playgroud)
但它从未安装过.我不知道下一步该做什么.这是我得到的日志:
Running install for module 'Archive::Zip'
Running make for P/PH/PHRED/Archive-Zip-1.58.tar.gz
Has already been unwrapped into directory /root/.cpan/build/Archive-Zip-1.58-1OzAcc
---- Unsatisfied dependencies detected during ----
---- PHRED/Archive-Zip-1.58.tar.gz ----
Test::MockModule [requires]
Running make test
Delayed until after prerequisites
Running make install
make test had returned bad status, won't install without force
Delayed until after prerequisites
Running install for module 'Test::MockModule'
Running Build for G/GF/GFRANKS/Test-MockModule-0.11.tar.gz
Has already been unwrapped into directory /root/.cpan/build/Test-MockModule-0.11-_LrG4F
'/usr/bin/perl Build.PL ' returned status 512, …Run Code Online (Sandbox Code Playgroud) 我在Laravel中使用SMTP配置了此电子邮件.它运作良好.
我希望一些用户能够使用自己的电子邮件地址发送电子邮件.
我曾经这样做过:
Mail::to($receiver)->from("myconfiguredSTMPemail@mycompany.com")->send(new email());
Run Code Online (Sandbox Code Playgroud)
我现在这样做:
Mail::to($receiver)->from($email_given_by_the_user)->send(new email());
Run Code Online (Sandbox Code Playgroud)
这工作正常,但我不喜欢这样,因为我实际上是通过我的电子邮件发送它们,而不是来自用户提供的电子邮件,即使最终用户将其视为$email_given_by_the_user.我想发送它,myconfiguredSTMPemail@mycompany.com但当用户想要回复时,它回复$email_given_by_the_user.有没有办法做到这一点?
我在路线中有这样的事情:
Route::post('/iteminfo/{item_id}','itemcontroller@get_item_info');
Run Code Online (Sandbox Code Playgroud)
在控制器中类似这样的东西
public function get_item_info($request)
{
$item_image = Item_Image->where("item_id",$request)->first();
$item_something = Item_Something->where("item_id",$request)->first();
$item_more = Item_More->where("item_id",$request)->first();
return Response::json($item_image);
}
Run Code Online (Sandbox Code Playgroud)
我想返回 3 件事,但是使用 return Response::json() 我只能返回 1 条语句(据我所知)。有没有办法全部退回?