Also; as you are not using the built-in routing mechanism for REST; in your case you'll also need to manually define rules to that Options action: (edited version of the code from your comments)'urlManager' => [ 'enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => [ 'POST <version:[w-]+>/users/verify' => '<version>/user/verify', 'POST <version:[w-]+>/airtime' => '<version>/airtime/airtime', 'POST <version:[w-]+>/bulk' => '<version>/routine/index', 'POST <version:[w-]+>/contact' => '<version>/contact/index', // OPTTIONS URI ENDPOINTS 'OPTIONS <version:[w-]+>/users/verify' => '<version>/user/options', 'OPTIONS <version:[w-]+>/airtime' => '<version>/airtime/options', 'OPTIONS <version:[w-]+>/bulk' => '<version>/routine/options', 'OPTIONS <version:[w-]+>/contact' => '<version>/contact/options', ],]; 这篇关于Post Request 在 Postman 中工作,但在 Angular 2 应用程序中返回 Preflight 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 03:03