Laravel 如何在php artisan中发出测试POST请求?

Laravel 如何在php artisan中发出测试POST请求?,laravel,laravel-5.2,Laravel,Laravel 5.2,我需要发出POST请求,我可以通过PHP artisan完成吗 我尝试使用GuzzleHttp执行此操作,但出现错误: ServerException in RequestException.php line 107: Server error: `POST http://localhost/public/api/order` resulted in a `500 Internal Server Error` response: <!DOCTYPE html> <html>

我需要发出POST请求,我可以通过PHP artisan完成吗

我尝试使用GuzzleHttp执行此操作,但出现错误:

ServerException in RequestException.php line 107:
Server error: `POST http://localhost/public/api/order` resulted in a `500 Internal Server Error` response:
<!DOCTYPE html>
<html>
<head>
<meta name="robots" content="noindex,nofollow" />
<style>
(truncated...)

那么,使用artisan有可能吗?

不确定我的方法有多有效,但这是我在过去运行过的一个示例

进入项目目录

键入php artisan tinker

创建要传递的参数数组:

$params=['paramOne'=>'valueOne','paramtoo'=>'valuetwoo']

创建要发送的请求的新实例。默认请求类型为: $request=light\Http\request::create$uri、$method、$params

如果您从Lightning类创建了自己的请求类,则自定义请求可以是这样的: $request=App\Http\Requests\MyExtendedRequest::create$uri、$methodType、$params

$uri是您要发送请求的位置 $methodType是使用GET、POST、PUT等的HTTP方法的类型

创建处理请求的控制器 $controller=newapp\Http\Controllers\MyController

提交请求。
$response=$controller->storeMission$request

不确定我的方法有多有效,但这是我过去运行过的一个示例

进入项目目录

键入php artisan tinker

创建要传递的参数数组:

$params=['paramOne'=>'valueOne','paramtoo'=>'valuetwoo']

创建要发送的请求的新实例。默认请求类型为: $request=light\Http\request::create$uri、$method、$params

如果您从Lightning类创建了自己的请求类,则自定义请求可以是这样的: $request=App\Http\Requests\MyExtendedRequest::create$uri、$methodType、$params

$uri是您要发送请求的位置 $methodType是使用GET、POST、PUT等的HTTP方法的类型

创建处理请求的控制器 $controller=newapp\Http\Controllers\MyController

提交请求。 $response=$controller->storeMission$request