我正在尝试加密在 CakePHP 中传递的 URL。我关注了这篇文章(http://bakery.cakephp.org/articles/yuri.salame/2008/07/15/encrypting-urls#),但它不起作用。我知道这是一篇旧文章。我正在使用 CakePHP 2.x
以下是显示的错误:
Notice (8): Undefined index: url [APP/webroot/index.php, line 108]
Warning (4096): Argument 1 passed to Dispatcher::dispatch() must be an instance of CakeRequest, null given, called in /home/xxx/domains/xxx.com/public_html/xxx/v3/app/webroot/index.php on line 110 and defined [CORE/Cake/Routing/Dispatcher.php, line 140]
Warning (4096): Argument 2 passed to Dispatcher::dispatch() must be an instance of CakeResponse, none given, called in /home/xxx/domains/xxx.com/public_html/xxx/v3/app/webroot/index.php on line 110 and defined [CORE/Cake/Routing/Dispatcher.php, line 140]
Notice (8): Trying to get property of non-object [CORE/Cake/Routing/Filter/AssetDispatcher.php, line 45]
我的app/webroot/index.php是(我只显示最后一部分):
App::uses('Dispatcher', 'Routing');
$url = do_decrypt($_REQUEST["url"]);
$Dispatcher = new Dispatcher();
$Dispatcher->dispatch($url);
$Dispatcher = new Dispatcher();
$Dispatcher->dispatch(
new CakeRequest(),
new CakeResponse()
);