如何在sugarcrm中修复和重建.htaccess



我正在SugarCRM中测试rest api。为了使用crm rest api,我添加了:

<IfModule mod_headers.c>
       Header set Access-Control-Allow-Origin "*"
</IfModule>
到 .htaccess 文件

并重建 .htaccess 文件。但是,它没有给我解决方案。我仍然收到包含以下内容的错误消息: XMLHttpRequest cannot load http://test.crm.loc/custom/clients/base/api/get_account.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access .我该如何解决它?

我找到了答案。我将以下代码放在 rest api 代码文件的顶部:

header('Access-Control-Allow-Origin: *');

它对我有用。

最新更新