【发布时间】:2019-05-22 12:39:56
【问题描述】:
我试图从我的网站向第三方发出发布请求。我想测试并查看请求的结果,所以我将它作为 Route::get 添加到我的 web.php 中,我访问了 url,我得到了这个错误
"UserId" : "UserId",
"Password" : "Password",
"Identity" : "Identity",
"Amount" : 0.0,
"Currency" : null,
"TransactionId" : null,
"RedirectURL" : null,
"PaymentType" : null,
"MobileNo" : null,
"Email" : null
"UserId" : "UserId",
"Password" : "Password",
"Identity" : "Identity",
"Amount" : 0.0,
"Currency" : null,
"TransactionId" : null,
"RedirectURL" : null,
"PaymentType" : null,
"MobileNo" : null,
"Email" : null
Error: PHP Fatal error: Class 'Illuminate\Support\ServiceProvider' not found in vendor\laravel\framework\src\Illuminate\Events\EventServiceProvider.php on line 8
我尝试进行作曲家更新、作曲家安装、php artisan clear-compiled 和作曲家转储自动加载。无论我在网站上走到哪里,我仍然遇到同样的错误。即使当我重新运行 php artisan serve 时...我一直收到错误,甚至没有命令完成他们的工作。
public function zainToken()
{
$data1 = ['UserId' => 'myid','Password' => 'mypw',
'Identity' => 'my_identification','Amount' => 0.0, 'Currency' => 'JOD','TransactionId' => null,'RedirectURL'=> null,'PaymentType' => null,'MobileNo' => null,'Email'=>null];
$curl = curl_init();
curl_setopt($ch, CURLOPT_URL,"theURlhere");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
$data1);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
print_r(json_decode($response));
}
}
它应该只是回显发布请求的结果...
【问题讨论】:
-
该错误是否仅出现在该控制器中?
theURIhere是第三方 URI 吗?如果你注释掉输出(echo 和 print_r),你还会得到同样的错误吗? -
不。可悲的是它无处不在。我什至不能做 php artisan serve。