dreamlife2014 2014-08-09 11:04
浏览 26
已采纳

在main.php yii中的URL设置中加密参数?

Here problem is with encrypt code in the url,

My url is this and encrypt code is at the last:

http://localhost/php_pro_106/reload/ByCustomer/mJYwIzoaIGe0R8lAVCqPhG%2Fg0jJFWjiWWdPnkq5VDlY%3D

In main.php Url settings:

'urlManager'=>array(
     'urlFormat'=>'path',
     'showScriptName' => false,
      'caseSensitive'=>false,
        'rules'=>array(
            'giftcard/<id:\w+>'=>'giftcard/index',
            'reload/ByCustomer/<giftcode:\w+>'=>'reload/ByCustomer',

             '<controller:\w+>/<id:\d+>'=>'<controller>/view',

           '<controller:\w+>/<action:\w+>/<id:\w+>'=>'<controller>/<action>',
            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

           ),
    ),

my action is in reload controller:

public function actionByCustomer()
  {

    echo "test";
    print_r($_GET);
    }

I am getting:

The requested URL     /localhost/reload/ByCustomer/mJYwIzoaIGe0R8lAVCqPhG/g0jJFWjiWWdPnkq5VDlY= was    
not found on this server.

Actually problem is with ByCustomer/mJYwIzoaIGe0R8lAVCqPhG%2Fg0jJFWjiWWdPnkq5VDlY%3D as it is encrypt.What Should I do to make it work?

  • 写回答

2条回答 默认 最新

  • dsm0688 2014-08-11 17:30
    关注

    I got the solution of it,For that I have to change my encode and decode method:

    The problem was due to some characters which are there in encoded Url.So, I have to replace these characters.

    In main.php Url Manager will be like:

      'reload/ByCustomer/<giftcode>'=>'reload/ByCustomer',
    

    The apache has problem with %2F in URL, it will always reply with 404, php script is not executed.

    EDIT:

    There's a solution, but it requires you can edit apache configuration file for your virtual host at least (I didn't have that at that time). Then you have to add AllowEncodedSlashes On inside your <VirtualHost>. Or you can also set it globally.

    If you dont want to do this.

    These links Help me:

    Stack over flow Solution1

    Stack over flow solution2

    google group

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算