dousui4577 2015-11-07 23:37
浏览 26
已采纳

如何通过Zend parms传递URL?

I'm trying to pass an URL (or just a local file path) via the Zend setPara(). Unfortunately the router interprets this as several params.

$redirector = $this->_helper->getHelper('Redirector');
$redirector->gotoSimple('download', null, null, array('TEMP_FILE' => '/srv/www/htdocs/tmp/output.pdf'));

Apache shows error 404. The downloadAction() isn't called. So maybe there is another way to pass an entire URL from one action to another?

  • 写回答

1条回答 默认 最新

  • download1323 2015-11-09 03:30
    关注
    $params = array('param1' => $param1, 'param2' => $param2);
    $this->_helper->redirector('download', 'yourcontroller', 'yourmodule', $params);
    

    if you dont have a module ..leave empty for that

    Another simple way

    $this->redirect('/module/controller/download/param1/value/param2/value2');
    

    update use urlencode for params

    $this->redirect('/module/controller/download/param1/'.urlencode(value).'/param2/'.urle
    ncode(value2).');
    

    and while accessing use urldecode(value);

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵