本文整理汇总了PHP中HTTP::readGET方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::readGET方法的具体用法?PHP HTTP::readGET怎么用?PHP HTTP::readGET使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTP
的用法示例。
在下文中一共展示了HTTP::readGET方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select
/**
* Returns a "<select></select>" box and selects the option matching the HTTP POST/GET data, or the value if the former is missing.
*
* @param string $name The <select> tag name.
* @param array $options An associative array of options. The keys contain
* the captions while the array elements contain the values. You can
* define an option group ("<optgroup>") by specifying an array of
* options as the value. For options with additional XHTML attributes,
* specify an array with the option value as the very first element and
* additional attributes thereafter.
* Example:
* <code>
* select('pizza', array(
* 'Regular' => array(
* 'Margherita' => array('margherita', 'title' => '50% Off Special'),
* 'Funghi' => 'funghi',
* 'Prosciutto' => 'prosciutto',
* 'Salame' => 'salame',
* ),
* 'Specials' => array(
* 'Mexican Style' => 'mexican',
* 'Spicy Curry' => 'curry',
* ),
* ));
* </code>
* @param mixed $value Optional. The value to select if no matching HTTP
* POST/GET variable exists. Default is NULL.
* @param array $attributes Optional. Additional attributes to include.
* You can use this e.g. to set a tag ID or to override the "type"
* attribute. Default is NULL.
* @param string $method Optional. Default is {@link METHOD_POST}.
* @return string
* @uses expandOptions()
*/
public static function select($name, array $options, $value = null, array $attributes = null, $method = self::METHOD_POST)
{
$selectedValue = $method == self::METHOD_POST ? HTTP::readPOST($name, $value) : HTTP::readGET($name, $value);
return '<select name="' . HTML::entities($name) . '" ' . HTML::expandAttributes($attributes) . '>' . self::expandOptions($options, $selectedValue) . '</select>';
}
示例2: Exception
if (!$userAuthenticated) {
if (isset($_REQUEST['username']) && $_REQUEST['username'] != '') {
$message = 'Wrong username or password!';
} else {
$message = 'Please login!';
}
throw new Exception($message);
}
} catch (Exception $e) {
if ($e->getMessage() != '') {
$xmlMeta->addChild(new \Xily\Xml('message', $e->getMessage(), array('class' => 'alert alert-error')));
}
$view = 'login';
}
if ($view === 'login') {
$returnUrl = HTTP::readGET('return', '');
if (!Form::verify('loginreturn', Form::METHOD_GET)) {
$returnUrl = '';
}
$xmlMeta->addChildren(array(new \Xily\Xml('tokenName', Form::getTokenName()), new \Xily\Xml('tokenValue', Form::getToken('login')), new \Xily\Xml('return', empty($returnUrl) ? $_SERVER['SCRIPT_URI'] : $returnUrl)));
}
// Check if there is a controller for the view
if (file_exists(CONTROLLER_DIR . $view . '.php')) {
include_once CONTROLLER_DIR . $view . '.php';
}
$controllerClass = ucfirst($view) . 'Controller';
if (class_exists($controllerClass)) {
$controller = new $controllerClass($locale);
$controller->enrichMeta($xmlMeta);
$xlyPage = $controller->getView();
} else {