本文整理汇总了PHP中url函数的典型用法代码示例。如果您正苦于以下问题:PHP url函数的具体用法?PHP url怎么用?PHP url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionModify
function actionModify()
{
$id = (int) $this->_context->get('id');
$rs = Account::find('user_id = ?', $id)->getOne();
if (!$rs->id()) {
return $this->msg($tip = '参数错误', url('manage::account'));
}
$form = Form_Common::createForm('', 'manage/profile');
if ($this->_context->isPOST() && $form->validate($_POST)) {
$post = $form->values();
$user_mail = $post['user_mail'];
$user_pass = $post['user_pass'];
$is_locked = $post['is_locked'] ? '1' : '0';
#dump($post);
if ($user_pass) {
$user_pass = sha1(md5('sike' . $post['user_pass'] . Q::ini('appini/secret_key')));
$rs->user_pass;
}
$rs->user_mail = $user_mail;
$rs->is_locked = $is_locked;
$rs->save();
return $this->msg($tip = '修改成功', url('manage::account/modify', array('id' => $id)));
}
$form->import($rs->toArray());
$form->element('user_pass')->value = '';
$form->element('is_locked')->checked = $rs->is_locked;
#dump($form->element('is_locked'));
$this->_view['form'] = $form;
$this->_view['rs'] = $rs;
$order = Order::find('user_id = ?', $id)->order('created DESC')->getAll();
$this->_view['order'] = $order;
$this->_view['_UDI'] = 'manage::account/index';
}
示例2: update
/**
* Update the specified resource in storage.
*
* @param Request $request
* @return Response
* @internal param User $user
* @internal param int $id
*/
public function update(Request $request)
{
$this->validate($request, ['first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'sex' => 'required', 'date_of_birth' => 'required']);
$request['date_of_birth'] = Carbon::parse($request->get('date_of_birth'));
Auth::user()->update($request->all());
return redirect(url('/users/show'))->with('message', "Successfully updated Your info.");
}
示例3: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($request->user()->admin) {
return $next($request);
}
return new RedirectResponse(url('post/liste'));
}
示例4: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return new RedirectResponse(url('/terrain'));
}
return $next($request);
}
示例5: settingsForm
/**
* Implements EntityReferenceHandler::settingsForm().
*/
public static function settingsForm($field, $instance)
{
$view_settings = empty($field['settings']['handler_settings']['view']) ? '' : $field['settings']['handler_settings']['view'];
$displays = views_get_applicable_views('entityreference display');
// Filter views that list the entity type we want, and group the separate
// displays by view.
$entity_info = entity_get_info($field['settings']['target_type']);
$options = array();
foreach ($displays as $data) {
list($view, $display_id) = $data;
if ($view->base_table == $entity_info['base table']) {
$options[$view->name . ':' . $display_id] = $view->name . ' - ' . $view->display[$display_id]->display_title;
}
}
// The value of the 'view_and_display' select below will need to be split
// into 'view_name' and 'view_display' in the final submitted values, so
// we massage the data at validate time on the wrapping element (not
// ideal).
$form['view']['#element_validate'] = array('entityreference_view_settings_validate');
if ($options) {
$default = !empty($view_settings['view_name']) ? $view_settings['view_name'] . ':' . $view_settings['display_name'] : NULL;
$form['view']['view_and_display'] = array('#type' => 'select', '#title' => t('View used to select the entities'), '#required' => TRUE, '#options' => $options, '#default_value' => $default, '#description' => '<p>' . t('Choose the view and display that select the entities that can be referenced.<br />Only views with a display of type "Entity Reference" are eligible.') . '</p>');
$default = !empty($view_settings['args']) ? implode(', ', $view_settings['args']) : '';
$form['view']['args'] = array('#type' => 'textfield', '#title' => t('View arguments'), '#default_value' => $default, '#required' => FALSE, '#description' => t('Provide a comma separated list of arguments to pass to the view.'));
} else {
$form['view']['no_view_help'] = array('#markup' => '<p>' . t('No eligible views were found. <a href="@create">Create a view</a> with an <em>Entity Reference</em> display, or add such a display to an <a href="@existing">existing view</a>.', array('@create' => url('admin/structure/views/add'), '@existing' => url('admin/structure/views'))) . '</p>');
}
return $form;
}
示例6: getCurrentUrl
/**
* @return null|string
*/
public function getCurrentUrl()
{
if (is_null($this->currentUrl)) {
return url()->current();
}
return $this->currentUrl;
}
示例7: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, array &$form_state)
{
$form['#action'] = url('ajax-test/dialog');
$form['description'] = array('#markup' => '<p>' . t("Ajax Form contents description.") . '</p>');
$form['submit'] = array('#type' => 'submit', '#value' => t('Do it'));
return $form;
}
示例8: bootstrap_sst_textfield
/**
* Overrides theme_textfield().
*/
function bootstrap_sst_textfield($variables)
{
$element = $variables['element'];
$element['#attributes']['type'] = 'text';
element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength'));
_form_set_class($element, array('form-text'));
$output = '<input' . drupal_attributes($element['#attributes']) . ' />';
$extra = '';
if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) {
drupal_add_library('system', 'drupal.autocomplete');
$element['#attributes']['class'][] = 'form-autocomplete';
$attributes = array();
$attributes['type'] = 'hidden';
$attributes['id'] = $element['#attributes']['id'] . '-autocomplete';
$attributes['value'] = url($element['#autocomplete_path'], array('absolute' => TRUE));
$attributes['disabled'] = 'disabled';
$attributes['class'][] = 'autocomplete';
// Uses icon for autocomplete "throbber".
if ($icon = _bootstrap_icon('refresh')) {
$output = '<div class="input-group">' . $output . '<span class="input-group-addon">' . $icon . '</span></div>';
} else {
$output = '<div class="input-group">' . $output . '<span class="input-group-addon">';
// The throbber's background image must be set here because sites may not
// be at the root of the domain (ie: /) and this value cannot be set via
// CSS.
$output .= '<span class="autocomplete-throbber" style="background-image:url(' . url('misc/throbber.gif') . ')"></span>';
$output .= '</span></div>';
}
$extra = '<input' . drupal_attributes($attributes) . ' />';
}
return $output . $extra;
}
示例9: index
public function index(Request $request)
{
$menus = app('menu')->where('parentid', '=', 0)->get();
$leftMainUrl = url('/dash/left_main?menuid=');
$params = ['menus' => $menus, 'left_main_url' => $leftMainUrl, 'crumb_url' => route('dash.crumbs')];
return view('dash.index', $params);
}
示例10: __construct
public function __construct($meta = array())
{
$this->label = t('Create new');
$this->icon = 'glyphicon-new-window';
$this->url = url(current_path(), array('action' => 'add'));
parent::__construct($meta);
}
示例11: msg
/**
* $code 消息代码
* $ctl 控制器
* $ac 方法名
* $reftime 跳转时间
*/
protected function msg($code, $ctl = '', $ac = '', $params = array(), $reftime = 3)
{
if (substr($code, 0, 1) == '-') {
$this->_V->assign("msgtype", 0);
} elseif (intval($code) > 10000 || intval($code) < 1000) {
$this->_V->assign("msgtype", -1);
} else {
$this->_V->assign("msgtype", 1);
}
//生成导航
$this->setNav(array('操作提示'));
// 生成跳转URL
if (empty($ctl)) {
$goto = 'javascript:history.back();';
} else {
$ac = empty($ac) ? "Index" : $ac;
$rurl = url($ctl, $ac, $params);
$goto = "javascript:document.location.href='" . $rurl . "'";
}
$this->_V->assign("rurl", $rurl);
$this->_V->assign("goto", $goto);
$this->_V->assign("code", $code);
$this->_V->assign("reftime", $reftime);
$this->_V->display("msg.htm");
exit;
}
示例12: _collectionsForm
/**
* This returns the form for the collections.
*
* @return Zend_Form
* @author Eric Rochester <erochest@virginia.edu>
**/
protected function _collectionsForm()
{
$ctable = $this->_helper->db->getTable('Collection');
$private = (int) get_option('solr_search_display_private_items');
if ($private) {
$collections = $ctable->findAll();
} else {
$collections = $ctable->findBy(array('public' => 1));
}
$form = new Zend_Form();
$form->setAction(url('solr-search/collections'))->setMethod('post');
$collbox = new Zend_Form_Element_MultiCheckbox('solrexclude');
$form->addElement($collbox);
foreach ($collections as $c) {
$title = metadata($c, array('Dublin Core', 'Title'));
$collbox->addMultiOption("{$c->id}", $title);
}
$etable = $this->_helper->db->getTable('SolrSearchExclude');
$excludes = array();
foreach ($etable->findAll() as $exclude) {
$excludes[] = "{$exclude->collection_id}";
}
$collbox->setValue($excludes);
$form->addElement('submit', 'Exclude');
return $form;
}
示例13: fusion_core_initialize_theme_settings
/**
* Initialize theme settings if needed
*/
function fusion_core_initialize_theme_settings($theme_name)
{
$theme_settings = theme_get_settings($theme_name);
if (is_null($theme_settings['theme_font_size']) || $theme_settings['rebuild_registry'] == 1) {
// Rebuild theme registry & notify user
if ($theme_settings['rebuild_registry'] == 1) {
drupal_rebuild_theme_registry();
drupal_set_message(t('Theme registry rebuild completed. <a href="!link">Turn off</a> this feature for production websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning');
}
// Retrieve saved or site-wide theme settings
$theme_setting_name = str_replace('/', '_', 'theme_' . $theme_name . '_settings');
$settings = variable_get($theme_setting_name, FALSE) ? theme_get_settings($theme_name) : theme_get_settings();
// Skip toggle_node_info_ settings
if (module_exists('node')) {
foreach (node_get_types() as $type => $name) {
unset($settings['toggle_node_info_' . $type]);
}
}
// Retrieve default theme settings
$defaults = fusion_core_default_theme_settings();
// Set combined default & saved theme settings
variable_set($theme_setting_name, array_merge($defaults, $settings));
// Force theme settings refresh
theme_get_setting('', TRUE);
}
}
示例14: fusion_core_initialize_theme_settings
/**
* Initialize theme settings if needed
*/
function fusion_core_initialize_theme_settings($theme_name)
{
$theme_settings = theme_get_settings($theme_name);
if (!isset($theme_settings['primary_menu_dropdown']) || $theme_settings['rebuild_registry'] == 1) {
static $registry_rebuilt = false;
// avoid multiple rebuilds per page
// Rebuild theme registry & notify user
if (isset($theme_settings['rebuild_registry']) && $theme_settings['rebuild_registry'] == 1 && !$registry_rebuilt) {
drupal_rebuild_theme_registry();
drupal_set_message(t('Theme registry rebuild completed. <a href="!link">Turn off</a> this feature for production websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning');
$registry_rebuilt = true;
}
// Retrieve saved or site-wide theme settings
$theme_setting_name = str_replace('/', '_', 'theme_' . $theme_name . '_settings');
$settings = variable_get($theme_setting_name, FALSE) ? theme_get_settings($theme_name) : theme_get_settings();
// Skip toggle_node_info_ settings
if (module_exists('node')) {
foreach (node_get_types() as $type => $name) {
unset($settings['toggle_node_info_' . $type]);
}
}
// Combine default theme settings from .info file & theme-settings.php
$theme_data = list_themes();
// get theme data for all themes
$info_theme_settings = $theme_name ? $theme_data[$theme_name]->info['settings'] : array();
$defaults = array_merge(fusion_core_default_theme_settings(), $info_theme_settings);
// Set combined default & saved theme settings
variable_set($theme_setting_name, array_merge($defaults, $settings));
// Force theme settings refresh
theme_get_setting('', TRUE);
}
}
示例15: index
public function index(Request $request)
{
//处理分享次数加1
$this->_shareTimes($request);
$key = 'bonus_' . $this->user->getKey() . '_game';
if (!Cache::has($key)) {
$times = 1;
Cache::forever($key, $times);
} else {
$times = intval(Cache::get($key, 0));
}
$this->_wechat = $this->getJsParameters();
$this->_times = $times;
$this->_uid = $this->user->getKey();
$this->_type_id = 3;
$this->_data = ['title' => '美猴捞红包', 'imgUrl' => 'plugins/img/m/monkey/monkey_main.jpg', 'desc' => '参加游戏,赢取猴子新年红包。'];
$this->_bonus_cnt = ActivityBonus::where('uid', $this->user->getKey())->where('status', 0)->count();
$stores_ids = $this->user->stores->pluck('id')->toArray();
$stores_id = array_pop($stores_ids);
$this->_share_url = url('m/home?sid=' . $stores_id . '&redirect_url=' . urlencode(url('m/game/loading') . '?uid=' . $this->_uid));
$this->_save_put_code = str_random(40);
$save_code_key = 'save_put_code_' . $this->user->getKey();
session([$save_code_key => $this->_save_put_code]);
//查找中奖列表
$this->_bonus_list = ActivityBonus::with(['users'])->orderBy('created_at', 'desc')->take(9)->get();
return $this->view('monkey::m.game');
}