解决跨域问题
对 config/cors.php 做以下更改
修改 paths,以指示需要保护哪些端点:在本例中为 api/ 和 sanctum/csrf-cookie.
'paths' => ['api/*'],
修改 allowed-origins 以指定接受请求的 URL. 这将是你的 React 应用程序的生产和开发 URL,https://233.sx (我的应用程序) and http://localhost:3000.
'allowed_origins' => ['https://233.sx', 'http://localhost:3000'],
然后将 support_credentials 设置为 true.
'supports_credentials' => true,