在我的应用程序中,我有这个课程。我使用的是Apache 2.4。似乎PATH_INFO
未激活。
我尝试配置htaccess AcceptPathInfo on
,但是它不起作用。
有什么想法允许吗?
班级
class SEFU implements \OM\ServiceInterface {
public static function start() {
if ( isset($_SERVER['ORIG_PATH_INFO']) ) {
if ( isset($_SERVER['PATH_INFO']) && empty($_SERVER['PATH_INFO']) ) {
$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
}
}
if ( isset($_SERVER['PATH_INFO']) && (strlen($_SERVER['PATH_INFO']) > 1) ) {
$parameters = explode('/', substr($_SERVER['PATH_INFO'], 1));
$_GET = [];
$GET_array = [];
$i = 0;
foreach ( $parameters as $parameter ) {
$param_array = explode(',', $parameter, 2);
if (!isset($param_array[1])) {
$param_array[1] = '';
}
if ( strpos($param_array[0], '[]') !== false ) {
$GET_array[substr($param_array[0], 0, -2)][] = $param_array[1];
} else {
$_GET[$param_array[0]] = $param_array[1];
}
$i++;
}
if ( count($GET_array) > 0 ) {
foreach ( $GET_array as $key => $value ) {
$_GET[$key] = $value;
}
}
}
return true;
}
public static function stop() {
return true;
}
}
Htaccess
Options -Indexes
Options +FollowSymlinks
AcceptPathInfo on
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /test/boutique/
RewriteCond %{THE_REQUEST} /index\.php/(\S*)\s [NC]
RewriteRule ^ %1 [L,R=301,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(?!index\.php$).* index.php/$0 [L,NC]
</IfModule>