<html>
<head>
<script src="adcity.js"></script>
</head>
<body>
<script>
if( window.adblockerCheck === undefined ){
// adblocker blocked our fake adcity.js file
// send event to GA or other analytics provider
}
</script>
</body>
</html>
答案 0 :(得分:1)
在Yii2中,UrlManager
类没有urlFormat
属性。相反,您可以使用enablePrettyUrl
并将其设置为true
。
答案 1 :(得分:0)
我复制了你正在使用的同样的 urlManager ,我也遇到了同样的错误。
<强>解决方案强>
从urlManager config中删除'urlFormat' => 'path'
。
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => false,
'showScriptName' => false,
'rules' => [
[
'class' => 'yii\rest\UrlRule',
'controller' => ['avatar'],
'teacher-time/index/<id:\d+>'=>'teacher-time/index',
],
],
],
它有效!
答案 2 :(得分:-1)
这是您的Nginx或Apache重写错误。
阿帕奇:
<VirtualHost 127.0.0.1:80>
ServerName test-yii2.com
DocumentRoot F:/wamp64/www/yii2/frontend/web
<Directory "F:/wamp64/www/yii2/frontend/web">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</Directory>