Laravel API在本地工作,但不能在托管服务器上

时间:2020-05-21 08:18:54

标签: laravel api

这些是我的路线:

Route::post('get_client', 'API\ClientController@ShowClient');
Route::post('new_loans', 'API\LoanController@ShowNewLoans');
Route::post('new_loans/{BR_ID}', 'API\LoanController@ShowNewLoans');

get_client,但可以在我的个人计算机上本地工作:

public function ShowClient(Request $request) {
    return response()->json(['message' => 'Okay'], 200);
}

以下在本地和服务器上均可正常运行:

public function ShowNewLoans($BR_ID = null) {
    if ($BR_ID == null) {
        $newLoans = Loans::where([
            ['APPLICATION_NO', NULL],
            ['OL_TEMP_APP_NO', '!=', NULL],
            ['ActivityListID', '!=', 5]
        ])->get();
    } else {
        $newLoans = Loans::where([
            ['APPLICATION_NO', NULL],
            ['OL_TEMP_APP_NO', '!=', NULL],
            ['ActivityListID', '!=', 5],
            ['BR_ID', $BR_ID]
        ])->get();
    }

    if ($newLoans->isEmpty()) {
        return response()->json(["message" => "There are no online new loan applications found."], 204);
    } else {
        return response()->json($newLoans, 200);
    }
}

我在这里想念什么?它们都使用相同的名称空间。这些代码在我的计算机上可以正常工作,但是当它在我的托管服务器(Amazon EC2)上时,它返回错误500。这些是邮递员的标头:

Date
Thu, 21 May 2020 08:16:22 GMT

Server
Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/7.3.15

X-Powered-By
PHP/7.3.15

Cache-Control
no-cache, private

Content-Length
1750

Connection
close

Content-Type
text/html; charset=UTF-8

0 个答案:

没有答案