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


PHP URL函数代码示例

本文整理汇总了PHP中URL函数的典型用法代码示例。如果您正苦于以下问题:PHP URL函数的具体用法?PHP URL怎么用?PHP URL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: init

 /**
  * Initialize the admin controller. Construct a menu to show all admin panels.
  *
  * @return void
  */
 public function init()
 {
     // If the user isn't an administrator, kick them out.
     if (!ET::$session->isAdmin()) {
         $this->redirect(URL("user/login?return=" . urlencode($this->selfURL)));
     }
     parent::init();
     // Construct the menus for the side bar.
     $this->defaultMenu = ETFactory::make("menu");
     $this->menu = ETFactory::make("menu");
     $this->defaultMenu->add("dashboard", "<a href='" . URL("admin/dashboard") . "'><i class='icon-dashboard'></i> " . T("Dashboard") . "</a>");
     $this->defaultMenu->add("settings", "<a href='" . URL("admin/settings") . "'><i class='icon-cog'></i> " . T("Forum Settings") . "</a>");
     $this->defaultMenu->add("appearance", "<a href='" . URL("admin/appearance") . "'><i class='icon-eye-open'></i> " . T("Appearance") . "</a>");
     $this->defaultMenu->add("channels", "<a href='" . URL("admin/channels") . "'><i class='icon-tags'></i> " . T("Channels") . "</a>");
     $this->defaultMenu->add("members", "<a href='" . URL("members") . "'><i class='icon-group'></i> " . T("Members") . "</a>");
     $this->defaultMenu->add("plugins", "<a href='" . URL("admin/plugins") . "'><i class='icon-puzzle-piece'></i> " . T("Plugins") . "</a>");
     $this->defaultMenu->highlight(ET::$controllerName);
     $this->menu->highlight(ET::$controllerName);
     // If new registrations require admin approval, add the 'unapproved' admin page with a count.
     if (C("esoTalk.registration.requireConfirmation") == "approval") {
         $count = ET::SQL()->select("COUNT(1)")->from("member")->where("confirmed", 0)->exec()->result();
         $this->menu->add("unapproved", "<a href='" . URL("admin/unapproved") . "'><i class='icon-lock'></i> " . T("Unapproved") . " <span class='badge'>" . $count . "</span></a>");
     }
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         $this->pushNavigation("admin", "administration", URL($this->selfURL));
     }
     $this->addJSFile("core/js/admin.js");
     $this->addCSSFile("core/skin/admin.css");
     $this->trigger("initAdmin", array($this->menu, $this->defaultMenu));
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:35,代码来源:ETAdminController.class.php

示例2: __construct

 public function __construct()
 {
     $this->script_url = URL('file/photos/delete_image');
     $this->upload_dir = public_path() . '/uploads/images/';
     $this->upload_url = URL('/') . '/uploads/images/';
     $this->fileName = 'files';
 }
开发者ID:Zachary-Leung,项目名称:wine_platform,代码行数:7,代码来源:PhotosController.php

示例3: IAUTH_auth

function IAUTH_auth($appid, $uid, $rightStr, $state = '', $faile_t = '2036-12-31 23:59:59')
{
    Check($appid, 'appid');
    Check($uid, 'uid');
    if (intval($uid) <= 0) {
        showError('use manage function instead');
    }
    Check($faile_t, 'faile_t');
    $rights = Check($rightStr, 'rights');
    $appType = GetAppInfo($appid, 'app_type');
    IAUTH_remove_auth($uid, $appid);
    if ($appType == 'WSC') {
        Check($state, 'state');
        $callback = GetAppInfo($appid, 'call_back');
        $verifier = newVerifier('auth', $appid, $uid, $rights, $faile_t, '', '', $state);
        accessLog('AUTH ' . $appid . ' ' . $uid . ' ' . $rightStr . ' ' . $faile_t . ' ' . $state);
        return URL($callback) . 'verifier=' . $verifier . '&state=' . $state;
    }
    if ($appType == 'UAC') {
        $verifier = newVerifier('auth', $appid, $uid, $rights, $faile_t);
        accessLog('AUTH ' . $appid . ' ' . $uid . ' ' . $rightStr . ' ' . $faile_t);
        return $verifier;
    }
    throw new IAuthException('db error');
}
开发者ID:shiyake,项目名称:php-ihome,代码行数:25,代码来源:IAuthManage.php

示例4: CORSOptions

 public function CORSOptions()
 {
     $statusCode = 204;
     $origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : URL();
     $headers = ['Access-Control-Allow-Origin' => $origin, 'Access-Control-Allow-Methods' => 'GET, PUT, POST, DELETE, OPTIONS', 'Access-Control-Allow-Headers' => 'Origin, Content-Type, Accept, Authorization, X-Requested-With, X-Experience-API-Version, X-Experience-API-Consistent-Through, Updated', 'Access-Control-Allow-Credentials' => 'true'];
     return \Response::make(null, $statusCode, $headers);
 }
开发者ID:jesposito,项目名称:learninglocker,代码行数:7,代码来源:BaseController.php

示例5: index

 public function index($pageSlug = false)
 {
     list($pageId, $slug) = explode('-', trim($pageSlug));
     if (!is_numeric($pageId)) {
         $this->redirect(URL(""));
     }
     $page = $this->model()->getById((int) $pageId);
     // Stop here with a 404 header if the page wasn't found.
     if (!$page) {
         $this->render404(T("message.pageNotFound"), true);
         return false;
     } elseif (!ET::$session->userId and $page['hideFromGuests']) {
         $this->render404(T("message.pageNotFound"), true);
         return false;
     }
     $this->title = $page["title"];
     if (strlen($page['content']) > 155) {
         $description = substr($page['content'], 0, 155) . " ...";
         $description = str_replace(array("\n\n", "\n"), " ", $description);
     } else {
         $description = $page["content"];
     }
     $this->addToHead("<meta name='description' content='" . sanitizeHTML($description) . "'>");
     $this->data("page", $page);
     $this->render($this->plugin()->getView("page"));
 }
开发者ID:ZerGabriel,项目名称:Pages,代码行数:26,代码来源:PagesController.class.php

示例6: action_subscribe

 /**
  * Toggle the user's subscription to a channel.
  *
  * @param int $channelId The ID of the channel to toggle subscription to.
  * @return void
  */
 public function action_subscribe($channelId = "")
 {
     if (!ET::$session->user or !$this->validateToken()) {
         return;
     }
     // If we don't have permission to view this channel, don't proceed.
     if (!ET::channelModel()->hasPermission((int) $channelId, "view")) {
         return;
     }
     // Work out if we're already unsubscribed or not, and switch to the opposite of that.
     $channel = ET::SQL()->select("unsubscribed, lft, rgt")->from("channel c")->from("member_channel mc", "mc.channelId = c.channelId AND mc.memberId = :userId", "left")->bind(":userId", ET::$session->userId)->where("c.channelId", (int) $channelId)->exec()->firstRow();
     // Get all the child channels of this channel.
     $rows = ET::SQL()->select("channelId")->from("channel")->where("lft >= :lft")->bind(":lft", $channel["lft"])->where("rgt <= :rgt")->bind(":rgt", $channel["rgt"])->exec()->allRows();
     $channelIds = array();
     foreach ($rows as $row) {
         $channelIds[] = $row["channelId"];
     }
     // Write to the database.
     ET::channelModel()->setStatus($channelIds, ET::$session->userId, array("unsubscribed" => !$channel["unsubscribed"]));
     // Normally, redirect back to the channel list.
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         redirect(URL("channels"));
     }
     // Otherwise, set a JSON var.
     $this->json("unsubscribed", !$channel["unsubscribed"]);
     $this->render();
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:33,代码来源:ETChannelsController.class.php

示例7: settings

 /**
  * Construct and process the settings form for this skin, and return the path to the view that should be 
  * rendered.
  * 
  * @param ETController $sender The page controller.
  * @return string The path to the settings view to render.
  */
 public function settings($sender)
 {
     // Set up the settings form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/plugins");
     $form->setValue("server", C("plugin.SMTP.server"));
     $form->setValue("username", C("plugin.SMTP.username"));
     $form->setValue("password", C("plugin.SMTP.password"));
     $form->setValue("port", C("plugin.SMTP.port"));
     $form->setValue("auth", C("plugin.SMTP.auth"));
     // If the form was submitted...
     if ($form->validPostBack("save")) {
         // Construct an array of config options to write.
         $config = array();
         $config["plugin.SMTP.server"] = $form->getValue("server");
         $config["plugin.SMTP.username"] = $form->getValue("username");
         $config["plugin.SMTP.password"] = $form->getValue("password");
         $config["plugin.SMTP.port"] = $form->getValue("port");
         $config["plugin.SMTP.auth"] = $form->getValue("auth");
         if (!$form->errorCount()) {
             // Write the config file.
             ET::writeConfig($config);
             $sender->message(T("message.changesSaved"), "success");
             $sender->redirect(URL("admin/plugins"));
         }
     }
     $sender->data("smtpSettingsForm", $form);
     return $this->getView("settings");
 }
开发者ID:nowaym,项目名称:esoTalk,代码行数:36,代码来源:plugin.php

示例8: redirect

    /**
     *  09/29 v0.1 js 轉址
     *  透過Jbox丟出訊息並轉址
     *  //% 9/30 引入外部檔案的位置暫用絕對路徑,要找方法改為"參數式"或"相對路徑",盡量避免使用絕對路徑
     * 
     *	@param str message : 顯示的訊息
     *  @param str url : 跳轉位址
     *  @param str dir : 登入完成後跳轉位址
     */
    public static function redirect($message = null, $url = null, $dir = null)
    {
        if ($message == null) {
            $message = 'Error. Please retry!';
        }
        if ($url == null) {
            $url = URL('/');
        }
        //若有"登入完成跳轉位址"則接上URL
        if ($dir != null) {
            $url .= '?dir=' . Crypt::encrypt($dir);
        }
        $location = 'location.href = "' . $url . '"';
        //jbox
        $js = 'var myModal = new jBox(\'Modal\', {
					content: \'<h4>' . $message . '</h4>\',
					onCloseComplete : function(){
						' . $location . '
					},
		}).open();';
        $action = '';
        $action .= '<script type="text/javascript" src="http://cindy-lo.tk/js/jquery-1.11.2.min.js"></script>';
        $action .= '<script type="text/javascript" src="http://cindy-lo.tk/js/jbox/jbox.js"></script>';
        $action .= '<link rel="stylesheet" type="text/css" href="http://cindy-lo.tk/js/jbox/jbox.css">';
        $action .= '<div>' . header('Content-type: text/html; charset=UTF-8') . '<script>' . $js . '</script></div>';
        return $action;
    }
开发者ID:bcawosxy,项目名称:mars,代码行数:36,代码来源:MyFunc.php

示例9: getleftmenu

 public function getleftmenu()
 {
     if (IS_AJAX) {
         $gid = I('post.gid');
         $controllermod = DD('AdminAuthController');
         $controllerlist = $controllermod->selbygid($gid);
         $ctl_arr = array();
         foreach ($controllerlist as $key => $li) {
             $ctl_arr[$li['id']] = $li;
         }
         $actionmod = DD('AdminAuthAction');
         $actionlist = $actionmod->selbygid($gid, 1);
         $ac_arr = array();
         foreach ($actionlist as $key => $ac) {
             $ac['url'] = URL($ac['group'] . '/' . $ac['controller'] . '/' . $ac['action'], '', $ac['app']);
             $ac_arr[$ac['cid']][] = $ac;
         }
         $menu = array();
         foreach ($ctl_arr as $key => $ca) {
             $ca['child'] = $ac_arr[$key];
             $menu[] = $ca;
         }
         echo json_encode($menu);
     }
 }
开发者ID:liutongju,项目名称:DreamCMSCN,代码行数:25,代码来源:IndexController.class.php

示例10: _chkauth

 private function _chkauth()
 {
     if (!session('Dream_admin')) {
         redirect(URL('Auth/Login/Login', '', 'Admin.php'));
     }
     $this->LoginAdminInfo = session('Dream_admin');
     $this->assign('LoginAdminInfo', $this->LoginAdminInfo);
 }
开发者ID:liutongju,项目名称:DreamCMSCN,代码行数:8,代码来源:AuthbaseController.class.php

示例11: action_denyAll

 /**
  * Deny all members.
  *
  * @return void
  */
 public function action_denyAll()
 {
     if (!$this->validateToken()) {
         return;
     }
     ET::memberModel()->delete(array("confirmed" => 0));
     $this->message(T("message.changesSaved"), "success autoDismiss");
     $this->redirect(URL("admin/unapproved"));
 }
开发者ID:davchezt,项目名称:fireside,代码行数:14,代码来源:ETUnapprovedAdminController.class.php

示例12: action_deny

 /**
  * Deny a member; delete their account.
  *
  * @param int $memberId The ID of the member to deny.
  * @return void
  */
 public function action_deny($memberId)
 {
     // Get this member's details. If it doesn't exist or is already approved, show an error.
     if (!($member = ET::memberModel()->getById((int) $memberId)) or $member["confirmed"]) {
         $this->redirect(URL("admin/unapproved"));
         return;
     }
     ET::memberModel()->deleteById($memberId);
     $this->message(T("message.changesSaved"), "success autoDismiss");
     $this->redirect(URL("admin/unapproved"));
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:17,代码来源:ETUnapprovedAdminController.class.php

示例13: handler_userController_initJoin

 public function handler_userController_initJoin($controller, $form)
 {
     $form->addSection("mscaptcha", T("Solve this"));
     $form->addField("mscaptcha", "mscaptcha", function ($form) {
         return "<div class=\"mscaptcha\"><img class=\"img-mscaptcha\" src=\"" . URL("mscaptcha") . "\" alt=\"MSCaptcha\"><i class=\"icon-spinner mscaptcha-loader\" style=\"display:none;\"> loading...</i><br /><a id=\"mscaptcha-refresh\" href=\"#\" class=\"button\"><i class=\"icon-refresh\"></i></a>" . $form->input("mscaptcha") . "</div>";
     }, function ($form, $key, &$data) {
         if (ET::$session->get('mscaptcha') != $form->getValue($key)) {
             ET::$session->store('inputmscaptha', $form->getValue($key));
             $form->error($key, T("Invalid!, You need calculator? :D"));
         }
     });
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:12,代码来源:plugin.php

示例14: Lang

 public function Lang()
 {
     $slug = \Request::segment(1) == 'eng' || \Request::segment(1) == 'home' ? 'slug' : 'eng_slug';
     $slugFind = \Request::segment(1) == 'eng' || \Request::segment(1) == 'home' ? 'eng_slug' : 'slug';
     $url = str_replace(\URL(), '', \URL::previous());
     if ($url == '/eng') {
         return \Redirect('/');
     } else {
         $menu = Menu::where($slug, $url)->first();
         return $url == '/' ? \Redirect('/eng') : \Redirect(\URL($menu[$slugFind]));
     }
 }
开发者ID:karpuzkan,项目名称:laravel,代码行数:12,代码来源:SiteController.php

示例15: run

 public function run()
 {
     $faker = Faker::create('zh_CN');
     $adminUser = User::where('name', '=', 'admin')->first();
     $adminUserId = isset($adminUser) ? $adminUser->id : 0;
     $publicPath = app('path.public');
     $dirPath = $publicPath . '/uploads/images/fakers';
     $urlDirPath = '/uploads/images/fakers';
     DB::table('pages')->delete();
     foreach (range(1, 100) as $index) {
         Page::create(['title' => 'znyesmaxfine单页' . $index, 'thumb' => URL($urlDirPath . '/' . $faker->image($dirPath, 640, 480, null, false)), 'slug' => '', 'content' => $faker->text, 'user_id' => $adminUserId, 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
     }
 }
开发者ID:Zachary-Leung,项目名称:wine_platform,代码行数:13,代码来源:PagesTableSeeder.php


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