Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php URL允许在结尾使用特殊字符。为什么?_Php_Zend Framework_Pimcore - Fatal编程技术网

Php URL允许在结尾使用特殊字符。为什么?

Php URL允许在结尾使用特殊字符。为什么?,php,zend-framework,pimcore,Php,Zend Framework,Pimcore,我的域名允许在末尾使用特殊字符(www.testing.com/home/login-)。由于正确的URL为www.testing.com/home/login,如何确保这是不允许的,并且显示页面不存在 $routeCustom = new \Zend_Controller_Router_Route( '/:controller/:action', array( 'module' => 'website', "controller" =>

我的域名允许在末尾使用特殊字符(www.testing.com/home/login-)。由于正确的URL为www.testing.com/home/login,如何确保这是不允许的,并且显示页面不存在

$routeCustom = new \Zend_Controller_Router_Route(
    '/:controller/:action',
    array(
        'module' => 'website',
        "controller" => "default",
        "action" => "default"
    ),
    array(
        'controller'=>'^[a-zA-Z-_0-9]+', //accept:  a to z , A to Z , - , _ , 0-9 
        'action'=>'^[a-zA-Z-_0-9]+'
    )
);
这就是为什么:

$routeCustom = new \Zend_Controller_Router_Route(
    '/:controller/:action',
    array(
        'module' => 'website',
        "controller" => "default",
        "action" => "default"
    ),
    array(
        'controller'=>'^[a-zA-Z-_0-9](.*[a-zA-Z0-9])$', //accept:  a to z , A to Z , - , _ , 0-9 
        'action'=>'^[a-zA-Z-_0-9](.*[a-zA-Z0-9])$'
    )
);

可能是一些重写或路由正在进行on@tim它会在.htaccess中吗?许多URL(带有不同的附件)可以指向一个资源。只要您总是选择并发布一个规范的,这并不重要。这是否真的会传递到服务器,请检查
$\u server['REQUEST\u URI']的输出。是的,这实际上是通过服务器@Progrock发送的