dongzine3782 2017-02-13 07:07
浏览 40
已采纳

Silverstripe - 检索数组中的POST数组

I have a form which I am using POST to post to the HTTP headers. I am trying to print_r the variables but I am not sure how to as the variables are in arrays within an array.

print_r($_POST); gives me

Array ( [y] => Array ( [0] => 124 ) [x] => Array ( [0] => 02:23PM ) )

My code:

public function index(SS_HTTPRequest $request) {

    if($request->postVars(y)) {
        print_r ($request);         
    }
}

I know I am missing something but not sure what it is.

  • 写回答

1条回答 默认 最新

  • douyuai8994 2017-02-13 07:40
    关注

    You are using postVars, which gives you all the post variables. What you want, to get a single postVar, is something like this: $request = $this->getRequest(); Debug::dump($request->postVar('x'));

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

报告相同问题?

悬赏问题

  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试