本文整理汇总了PHP中url::query方法的典型用法代码示例。如果您正苦于以下问题:PHP url::query方法的具体用法?PHP url::query怎么用?PHP url::query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类url
的用法示例。
在下文中一共展示了url::query方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delivery_info
/**
* Calculates the charge and delivery time for
* a parcel.
*
* @param array $parcel
* @throws Kohana_Exception
* @return array Delivery charge and number of days
*/
public static function delivery_info($parcel)
{
// Check required fields exist
foreach (Kohana::config('auspost.fields') as $key) {
if (!array_key_exists($key, $parcel)) {
throw new Kohana_Exception('Missing key in $parcel array: ' . $key);
}
}
// Build URL
$url = Kohana::config('auspost.url') . url::query($parcel, FALSE);
// Retrieve URL
$response = Request::factory($url)->execute()->body();
// Split into lines
$lines = explode("\r\n", trim($response));
// Split lines into key / value pairs
$data = array();
foreach ($lines as $line) {
list($key, $val) = explode("=", $line);
$data[$key] = $val;
}
// Return Data
return $data;
}
示例2: queryToString
public static function queryToString($query = null)
{
if (is_null($query)) {
$query = url::query();
}
return http_build_query($query);
}
示例3: defined
<?php
defined('SYSPATH') or die('No direct script access.');
/**
* @version SVN: $Id:$
*/
echo form::input($name, $value);
?>
<script type="text/javascript">
$(document).ready(function(){
$('[name=<?php
echo $name;
?>
]').autocomplete( {
source: '<?php
echo url::query(array('select_autocomplete' => $name));
?>
',
mustMatch: true
});
});
</script>
示例4:
echo url::base(FALSE, 'ftp');
?>
<br/>
<?php
echo url::site('controller/action');
?>
<br/>
<?php
echo url::site('controller/action', 'ftp');
?>
<br/>
<?php
echo url::query();
?>
<br/>
<?php
echo url::query(array('bar' => 'foo'));
?>
<br/>
<?php
echo url::title('This is my title');
示例5: action_run
/**
* Handles test running interface
*/
public function action_run()
{
$this->template->body = View::factory('unittest/results');
// Get the test suite and work out which groups we're testing
$suite = Unittest_tests::suite();
$group = (array) Arr::get($_GET, 'group', array());
// Stop phpunit from interpretting "all groups" as "no groups"
if (empty($group) or empty($group[0])) {
$group = array();
}
// Only collect code coverage if the user asked for it
$collect_cc = (bool) Arr::get($_GET, 'collect_cc', FALSE);
if ($collect_cc and Arr::get($_GET, 'use_whitelist', FALSE)) {
$whitelist = $this->whitelist(Arr::get($_GET, 'whitelist', array()));
}
$runner = new Kohana_Unittest_Runner($suite);
try {
$runner->run($group, $collect_cc);
if ($collect_cc) {
$this->template->body->set('coverage', $runner->calculate_cc_percentage());
}
if (isset($whitelist)) {
$this->template->body->set('coverage_explanation', $this->nice_whitelist_explanation($whitelist));
}
} catch (Kohana_Exception $e) {
// Code coverage is not allowed, possibly xdebug disabled?
// TODO: Tell the user this?
$runner->run($group);
}
// Show some results
$this->template->body->set('results', $runner->results)->set('totals', $runner->totals)->set('time', $this->nice_time($runner->time))->set('group', Arr::get($this->get_groups_list($suite), reset($group), 'All groups'))->set('groups', $this->get_groups_list($suite))->set('run_uri', $this->request->uri())->set('report_uri', $this->report_uri . url::query())->set('whitelistable_items', $this->get_whitelistable_items())->set('whitelisted_items', isset($whitelist) ? array_keys($whitelist) : array())->set('whitelist', !empty($whitelist));
}
示例6: pageURL
/**
* Returns a page url for any given page number
*
* @param int $page The page number
* @return string The url
*/
public function pageURL($page)
{
if ($this->options['method'] == 'query') {
$query = url::query();
if ($page == 1) {
unset($query[$this->options['variable']]);
} else {
$query[$this->options['variable']] = $page;
}
return url::build(array('query' => $query));
} else {
$params = url::params();
if ($page == 1) {
unset($params[$this->options['variable']]);
} else {
$params[$this->options['variable']] = $page;
}
return url::build(array('params' => $params));
}
}
示例7: query
public function query()
{
return new Request\Query(url::query());
}