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


PHP Http::setParam方法代码示例

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


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

示例1: testIsAjax

 public function testIsAjax()
 {
     $this->_model = $this->getModel();
     $this->assertFalse($this->_model->isAjax());
     $this->_model->clearParams();
     $this->_model->setParam('ajax', 1);
     $this->assertTrue($this->_model->isAjax());
     $this->_model->clearParams();
     $this->_model->setParam('isAjax', 1);
     $this->assertTrue($this->_model->isAjax());
     $this->_model->clearParams();
     $this->_model->getHeaders()->addHeaderLine('X-Requested-With', 'XMLHttpRequest');
     $this->assertTrue($this->_model->isAjax());
     $this->_model->getHeaders()->clearHeaders();
     $this->_model->getHeaders()->addHeaderLine('X-Requested-With', 'NotXMLHttpRequest');
     $this->assertFalse($this->_model->isAjax());
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:17,代码来源:HttpTest.php

示例2: testIsAjax

 public function testIsAjax()
 {
     $this->_model = $this->_model = $this->getModel();
     $this->assertFalse($this->_model->isAjax());
     $this->_model->clearParams();
     $this->_model->setParam('ajax', 1);
     $this->assertTrue($this->_model->isAjax());
     $this->_model->clearParams();
     $this->_model->setParam('isAjax', 1);
     $this->assertTrue($this->_model->isAjax());
     $this->_model->clearParams();
     $server = $_SERVER;
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
     $this->assertTrue($this->_model->isAjax());
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'NotXMLHttpRequest';
     $this->assertFalse($this->_model->isAjax());
     $_SERVER = $server;
 }
开发者ID:,项目名称:,代码行数:18,代码来源:

示例3: testIsAjax

 public function testIsAjax()
 {
     $this->_model = new Request($this->_routerListMock, $this->_infoProcessorMock);
     $this->assertFalse($this->_model->isAjax());
     $this->_model->clearParams();
     $this->_model->setParam('ajax', 1);
     $this->assertTrue($this->_model->isAjax());
     $this->_model->clearParams();
     $this->_model->setParam('isAjax', 1);
     $this->assertTrue($this->_model->isAjax());
     $this->_model->clearParams();
     $server = $_SERVER;
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
     $this->assertTrue($this->_model->isAjax());
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'NotXMLHttpRequest';
     $this->assertFalse($this->_model->isAjax());
     $_SERVER = $server;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:18,代码来源:HttpTest.php


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