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


PHP Request::getVar方法代码示例

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


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

示例1: testGetVar

 /**
  * @covers Xoops\Core\Request::getVar
  */
 public function testGetVar()
 {
     $varname = 'RequestTest';
     $value = 'testing';
     $_REQUEST[$varname] = $value;
     $this->assertEquals($value, Request::getVar($varname));
     $this->assertNull(Request::getVar($varname . 'no-such-key'));
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:11,代码来源:RequestTest.php

示例2: Permission

 * @license      GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package      debugbar
 * @since
 * @author       XOOPS Development Team
 */
use Xoops\Core\Request;
use Xmf\Module\Helper;
use Xmf\Module\Permission;
include_once __DIR__ . '/admin_header.php';
$moduleAdmin = new \Xoops\Module\Admin();
$moduleAdmin->displayNavigation('permissions.php');
$helper = Helper::getHelper('monolog');
$permHelper = new Permission();
if ($permHelper) {
    // this is the name and item we are going to work with
    $gperm_name = 'use_monolog';
    $gperm_itemid = 0;
    // if this is a post operation get our variables
    if ('POST' === Request::getMethod()) {
        $name = $permHelper->defaultFieldName($gperm_name, $gperm_itemid);
        $groups = Request::getVar($name, array(), 'POST');
        $permHelper->savePermissionForItem($gperm_name, $gperm_itemid, $groups);
        echo $xoops->alert('success', _MA_MONOLOG_FORM_PROCESSED, _MA_MONOLOG_PERMISSION_FORM);
    }
    $form = new \Xoops\Form\ThemeForm(_MA_MONOLOG_PERMISSION_FORM, 'form', '', 'POST');
    $permElement = $permHelper->getGroupSelectFormForItem($gperm_name, $gperm_itemid, _MA_MONOLOG_PERMISSION_GROUPS, null, true);
    $form->addElement($permElement);
    $form->addElement(new \Xoops\Form\Button('', 'submit', _MA_MONOLOG_FORM_SUBMIT, 'submit'));
    echo $form->render();
}
include_once __DIR__ . '/admin_footer.php';
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:permissions.php

示例3: launchApp

if ($sessionHelper) {
    $var = $sessionHelper->get('test_dir');
    if ($var) {
        $test_dir = $var;
    }
}
// if this is a post operation get our test_dir, save it and redirect to app
if ('GET' == Request::getMethod()) {
    $var = Request::getVar('test_dir', '', $hash = 'GET');
    if (!empty($var)) {
        launchApp($var);
    }
}
// if this is a post operation get our test_dir, save it and redirect to app
if ('POST' == Request::getMethod()) {
    $test_dir = Request::getVar('test_dir', '', $hash = 'POST');
    if (empty($test_dir)) {
        $test_dir = $config_test_dir;
    }
    if ($sessionHelper) {
        $sessionHelper->set('test_dir', $test_dir);
    }
    launchApp($test_dir);
}
$form = new \Xoops\Form\ThemeForm('', 'form', '', 'POST');
$form->addElement(new \Xoops\Form\Text('Unit Test Directory', 'test_dir', 5, 512, $test_dir));
$form->addElement(new \Xoops\Form\Button('', 'submit', 'Launch', 'submit'));
echo $form->render();
echo '<br \\><a href="?test_dir=' . $xoops->path('modules/' . $dir . '/app/tests') . '">Examples</a>';
$xoops->footer();
/**
开发者ID:geekwright,项目名称:xvpu,代码行数:31,代码来源:index.php


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