当前位置: 首页>>代码示例>>PHP>>正文


PHP CakeRequest::param方法代码示例

本文整理汇总了PHP中CakeRequest::param方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeRequest::param方法的具体用法?PHP CakeRequest::param怎么用?PHP CakeRequest::param使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CakeRequest的用法示例。


在下文中一共展示了CakeRequest::param方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testParamWriting

 /**
  * test writing request params with param()
  *
  * @return void
  */
 public function testParamWriting()
 {
     $request = new CakeRequest('/');
     $request->addParams(array('action' => 'index'));
     $this->assertInstanceOf('CakeRequest', $request->param('some', 'thing'), 'Method has not returned $this');
     $request->param('Post.null', null);
     $this->assertNull($request->params['Post']['null']);
     $request->param('Post.false', false);
     $this->assertFalse($request->params['Post']['false']);
     $request->param('Post.zero', 0);
     $this->assertSame(0, $request->params['Post']['zero']);
     $request->param('Post.empty', '');
     $this->assertSame('', $request->params['Post']['empty']);
     $this->assertSame('index', $request->action);
     $request->param('action', 'edit');
     $this->assertSame('edit', $request->action);
 }
开发者ID:xMyThoLoGyx,项目名称:centremedicaletp3,代码行数:22,代码来源:CakeRequestTest.php

示例2: testReadingParams

 /**
  * Test using param()
  *
  * @return void
  */
 public function testReadingParams()
 {
     $request = new CakeRequest();
     $request->addParams(array('controller' => 'posts', 'admin' => true, 'truthy' => 1, 'zero' => '0'));
     $this->assertFalse($request->param('not_set'));
     $this->assertTrue($request->param('admin'));
     $this->assertEquals(1, $request->param('truthy'));
     $this->assertEquals('posts', $request->param('controller'));
     $this->assertEquals('0', $request->param('zero'));
 }
开发者ID:linking-arts,项目名称:cakeStrap,代码行数:15,代码来源:CakeRequestTest.php


注:本文中的CakeRequest::param方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。