0

我的表格中有这个

<?php

echo $this->Form->create('Vendor', array(
'url' => array_merge(array('action' => 'index'), $this->params['pass'])
));
echo $this->Form->input('vendor_name', array('div' => false,'empty'=>true));
echo $this->Form->input('is_finalized', array('div' => false,'empty'=>true));
echo $this->Form->submit(__('Search', true), array('div' => false));
echo $this->Form->end();

?>

我的控制器里有这个

var_dump($this->request);

当我查看它的 var_dump 时,$this->request 中有一个 data 属性。请看下面的转储。但是当我这样做时 var_dump($this->request->data); 我得到一个空数组。您可以在下面看到 $this->request var_dump 下的公共数据

这是 $this->request 的 var_dump

object(CakeRequest)[9]
  public 'params' => 
    array (size=5)
      'plugin' => null
      'controller' => string 'vendors' (length=7)
      'action' => string 'index' (length=5)
      'named' => 
        array (size=0)
          empty
      'pass' => 
        array (size=0)
          empty
  public 'data' => 
    array (size=1)
      'Vendor' => 
        array (size=2)
          'vendor_name' => string 'fudatools' (length=9)
          'is_finalized' => string '1' (length=1)
  public 'query' => 
    array (size=0)
      empty
  public 'url' => string 'vendors' (length=7)
  public 'base' => string '/hiVendors' (length=10)
  public 'webroot' => string '/hiVendors/' (length=11)
  public 'here' => string '/hiVendors/vendors' (length=18)
  protected '_detectors' => 
    array (size=11)
      'get' => 
        array (size=2)
          'env' => string 'REQUEST_METHOD' (length=14)
          'value' => string 'GET' (length=3)
      'post' => 
        array (size=2)
          'env' => string 'REQUEST_METHOD' (length=14)
          'value' => string 'POST' (length=4)
      'put' => 
        array (size=2)
          'env' => string 'REQUEST_METHOD' (length=14)
          'value' => string 'PUT' (length=3)
      'delete' => 
        array (size=2)
          'env' => string 'REQUEST_METHOD' (length=14)
          'value' => string 'DELETE' (length=6)
      'head' => 
        array (size=2)
          'env' => string 'REQUEST_METHOD' (length=14)
          'value' => string 'HEAD' (length=4)
      'options' => 
        array (size=2)
          'env' => string 'REQUEST_METHOD' (length=14)
          'value' => string 'OPTIONS' (length=7)
      'ssl' => 
        array (size=2)
          'env' => string 'HTTPS' (length=5)
          'value' => int 1
      'ajax' => 
        array (size=2)
          'env' => string 'HTTP_X_REQUESTED_WITH' (length=21)
          'value' => string 'XMLHttpRequest' (length=14)
      'flash' => 
        array (size=2)
          'env' => string 'HTTP_USER_AGENT' (length=15)
          'pattern' => string '/^(Shockwave|Adobe) Flash/' (length=26)
      'mobile' => 
        array (size=2)
          'env' => string 'HTTP_USER_AGENT' (length=15)
          'options' => 
            array (size=26)
              ...
      'requested' => 
        array (size=2)
          'param' => string 'requested' (length=9)
          'value' => int 1
  protected '_input' => string '' (length=0)
4

1 回答 1

0

你有一个错误

var_dump($this->request); 用。。。来代替

print_r($this->request->data);

于 2014-08-14T14:10:11.573 回答