小编Tri*_*adi的帖子

Yii1 中的 URL 管理器和 Htaccess

我有这样的网址:

www.studyenglish/index.php?r=site/lesson&act=read&id=1

我希望更改为:

www.studyenglish/site/lesson/read

我已在 url 管理器 config/main.php 中添加了此脚本

'urlManager'=>array(
       ....
       'showScriptName'=>false,
        ....
    ),
Run Code Online (Sandbox Code Playgroud)

并将此脚本添加到 .htaccess 中

Options +FollowSymLinks
RewriteEngine on
RewriteBase /

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php
Run Code Online (Sandbox Code Playgroud)

但它只适用于这样的 url:

www.studyenglish/index.php?r=site/lesson

成为:

www.studyenglish/site/lesson

那么,如何更改此网址

www.studyenglish/index.php?r=site/lesson&act=read&id=1

成为

www.studyenglish/site/lesson/read

希望有人可以提供帮助。谢谢 ...

php .htaccess yii1.x

5
推荐指数
1
解决办法
2539
查看次数

如何用php计算数组空值?

如何计算值为空的数组的数量。例如,我有数组结果:

    Array (
       [0] => 'A',
       [1] => 'B',
       [2] => 'C',
       [3] => '',
       [4] => '',
       [5] => 'F',
       [6] => '')
Run Code Online (Sandbox Code Playgroud)

这里有3个空数组值(索引3,4,6),那么如何获取空数组值的数量

php arrays

1
推荐指数
1
解决办法
3713
查看次数

标签 统计

php ×2

.htaccess ×1

arrays ×1

yii1.x ×1