【发布时间】:2019-01-01 14:41:53
【问题描述】:
我正在使用AltoRouter 将我的网址路由到正确的文件。现在基本上here,我已经描述了我的问题。
在一页上,我有一个警报,由引导程序设置样式。
定义就这么简单:
$('#wrongPasswordDiv').html('<br/><div class="alert alert-danger" id="wrongPWAlert" role="alert">Falsches Passwort. Bitte erneut versuchen!</div>');
此外,之前还包含 Bootstrap css 文件:
<link rel="stylesheet" type="text/css" href="/bootstrapcss" />
bootstrapcss 使用AltoRouter 和这行代码路由到正确的 css 文件:
$router->map('GET','/bootstrapcss','vendor/twbs/bootstrap/dist/css/bootstrap.css','bootstrapcss');
现在,在控制台中,它会抛出一个警告说Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/bootstrapcss"。
如果我使用 css 文件的完整路径、CDN 或删除 DOCTYPE,它可以正常工作。但是我不想做这些变体中的任何一个...删除文档类型,可能会损坏其他功能,如果我要使用完整的 css 路径,那么我就不需要路由...
有什么想法可以发送Content-type: text/css 标头以使其正常工作吗?
【问题讨论】:
标签: php html css url-routing altorouter