第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

React + Laravel 7 API - CORS 問(wèn)題

React + Laravel 7 API - CORS 問(wèn)題

PHP
料青山看我應(yīng)如是 2023-07-08 16:35:35
我正在嘗試制作一個(gè)簡(jiǎn)單的注冊(cè)表單(只是在學(xué)習(xí)),但我遇到了 CORS 問(wèn)題。我已經(jīng)嘗試了所有我發(fā)現(xiàn)的東西,但沒(méi)有一個(gè)起作用。據(jù)我所知,Laravel 7 已經(jīng)可以防止 CORS 問(wèn)題,但我的卻不能。這是我的代碼:api.php<?phpuse Illuminate\Http\Request;use Illuminate\Support\Facades\Route;/*|--------------------------------------------------------------------------| API Routes|--------------------------------------------------------------------------|| Here is where you can register API routes for your application. These| routes are loaded by the RouteServiceProvider within a group which| is assigned the "api" middleware group. Enjoy building your API!|*/Route::group([    'prefix' => 'auth',], function () {    Route::post('login', 'AuthController@login');    Route::post('signup', 'AuthController@signup');    Route::group([        'middleware' => 'auth:api'    ], function () {        Route::get('logout', 'AuthController@logout');        Route::get('user',  'AuthController@user');    });});Route::middleware('auth:api')->get('/user', function (Request $request) {    return $request->user();});cors.php<?phpreturn [    /*    |--------------------------------------------------------------------------    | Cross-Origin Resource Sharing (CORS) Configuration    |--------------------------------------------------------------------------    |    | Here you may configure your settings for cross-origin resource sharing    | or "CORS". This determines what cross-origin operations may execute    | in web browsers. You are free to adjust these settings as needed.    |    | To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS    |    */    'paths' => ['api/*'],    'allowed_methods' => ['*'],    'allowed_origins' => ['*'],    'allowed_origins_patterns' => [],    'allowed_headers' => ['*'],    'exposed_headers' => [],    'max_age' => 0,    'supports_credentials' => false,];
查看完整描述

1 回答

?
倚天杖

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超3個(gè)贊

我通過(guò)在 axios 請(qǐng)求中添加“http://”解決了這個(gè)問(wèn)題。



查看完整回答
反對(duì) 回復(fù) 2023-07-08
  • 1 回答
  • 0 關(guān)注
  • 140 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)