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


PHP uri函数代码示例

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


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

示例1: renderBody

 /**
  * Render response body
  * @param  array      $env
  * @param  \Exception $exception
  * @return string
  */
 protected function renderBody(&$env, $exception)
 {
     $title = 'Oops! Exception detected';
     $code = $exception->getCode();
     $message = $exception->getMessage();
     $file = $exception->getFile();
     $line = $exception->getLine();
     $trace = str_replace(array('#', '\\n'), array('<div>#', '</div>'), $exception->getTraceAsString());
     $html = sprintf('<h1>%s</h1>', $title);
     $html .= '<p>Something is broken, the application could not run, Pulse has detected the following error:</p>';
     $html .= '<h2>Details</h2>';
     $html .= sprintf('<div><strong>Type:</strong> %s</div>', get_class($exception));
     if ($code) {
         $html .= sprintf('<div><strong>Code:</strong> %s</div>', $code);
     }
     if ($message) {
         $html .= sprintf('<div><strong>Message:</strong> %s</div>', $message);
     }
     if ($file) {
         $html .= sprintf('<div><strong>File:</strong> %s</div>', $file);
     }
     if ($line) {
         $html .= sprintf('<div><strong>Line:</strong> %s</div>', $line);
     }
     if ($trace) {
         $html .= '<h2>Trace</h2>';
         $html .= sprintf('<pre>%s</pre>', $trace);
     }
     return sprintf("<!doctype html><html lang=\"es\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><link rel=\"stylesheet\" href=\"" . asset('bootstrap.min.css') . "\"><link rel=\"stylesheet\" href=\"" . asset('styles.css') . "\"><title>%s</title><link rel=\"icon\" type=\"image/png\" href=\"" . asset('pulseLogo.png') . "\" /></head><body><nav class=\"navbar navbar-inverse navbar-fixed-top\"> <div class=\"container\"><div class=\"navbar-header\"><button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\"><span class=\"sr-only\">Toggle navigation</span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span></button><a class=\"navbar-brand\" href=\"" . basePath() . "\"><img src=\"" . asset('pulseLogo.png') . "\" width=\"25\"> PULSE Framework</a></div><div id=\"navbar\" class=\"collapse navbar-collapse\"><ul class=\"nav navbar-nav\"><li><a href=\"" . basePath() . "\">Página principal</a></li><li><a href=\"" . uri('documentationUrl') . "\">Documentation</a></li><li><a href=\"" . uri('communityUrl') . "\">Pulse Community</a></li><li><a href=\"" . uri('tutosUrl') . "\">Tutorials</a></li></ul></div></div></nav><div class=\"container\"><div class=\"starter-template\">%s</div></div><script src=\"" . asset('jquery.min.js') . "\"></script><script src=\"" . asset('bootstrap.min.js') . "\"></script></body></html>", $title, $html);
 }
开发者ID:ferdinandmartin,项目名称:pulse,代码行数:36,代码来源:ErrorReporting.php

示例2: a

function a($uri, $anchor, $uriQuery = "")
{
    if ($uriQuery === "") {
        return sprintf('<a href="%s">%s</a>', uri($uri), $anchor);
    } else {
        return sprintf('<a href="%s?%s">%s</a>', uri($uri), $uriQuery, $anchor);
    }
}
开发者ID:reoring,项目名称:sabel,代码行数:8,代码来源:application.php

示例3: uri_info

/**
 * Get the specified URI info.
 *
 * @param string $name
 *
 * @return mixed
 */
function uri_info($name = null)
{
    static $container = array();
    if (empty($container)) {
        $url = uri();
        $container = parse_url($url);
    }
    return null === $name ? $container : $container[$name];
}
开发者ID:smarty-kiki,项目名称:frame,代码行数:16,代码来源:vc.php

示例4: fake_cron_public_theme_header

function fake_cron_public_theme_header()
{
    echo "<script type='text/javascript' src='" . WEB_PLUGIN . "/FakeCron/views/javascripts/fakecron.js'></script>";
    $tasksTable = get_db()->getTable("FakeCron_Task");
    $html = "<script type='text/javascript'>";
    $html .= "FakeCron.baseURL='" . uri('fake-cron/tasks/fakecron/') . "' ; ";
    $html .= "FakeCron.tasks = " . $tasksTable->buildTasksJSON() . ";";
    $html .= "</script>";
    echo $html;
}
开发者ID:patrickmj,项目名称:FakeCron,代码行数:10,代码来源:plugin.php

示例5: auth_require

function auth_require($target = false)
{
    global $config;
    if (auth_ok()) {
        return;
    }
    if ($target) {
        redirect(uri($target));
    }
    exit;
}
开发者ID:senko,项目名称:rfx,代码行数:11,代码来源:user.php

示例6: update

 /**
  * @httpMethod post
  *
  * @check_client_id
  */
 public function update()
 {
     $user = $this->aclUser;
     $result = $this->getLogic("status")->post($user->id, $this->comment);
     if ($this->isAjaxRequest()) {
         if ($result->isSuccess()) {
             $this->ajax->values = array("id" => $result->aStatus->id, "name" => $user->name, "comment" => showComment($result->aStatus->comment), "updated" => showUpdatedAt($result->aStatus->created_at), "user_home" => uri("n: users, c: {$user->name}, a: "), "image_uri" => user_avatarize($user->id), "status_uri" => uri("c: index, a: status, param: {$result->aStatus->id}"), "trash_gif" => linkto("images/trash.gif"), "reply_gif" => linkto("images/reply.gif"));
         } else {
             $this->ajax->failure();
         }
     } else {
         $this->redirect->to("n: default, c: user, a: home");
     }
 }
开发者ID:hamaco,项目名称:phwittr-on-xoops,代码行数:19,代码来源:Status.php

示例7: showComment

function showComment($comment)
{
    static $uri = "";
    if ($uri === "") {
        $uri = uri("n: users, c: %s, a: ");
    }
    $comment = h($comment);
    if (preg_match('/^@(\\w{1,20})/', $comment, $matches) === 1) {
        $_uri = sprintf($uri, $matches[1]);
        $comment = preg_replace("/{$matches[0]}/", "@<a href=\"{$_uri}\">{$matches[1]}</a>", $comment, 1);
    }
    // @todo ちゃんとやる? <a href="...">...</a>とか.
    $comment = preg_replace('~(https?://[a-zA-Z0-9][\\w\\-\\.]*\\.[a-z]+/[\\w\\-\\.\\~\\*\\?\\+\\$/@&=%#:;,]*)~', '<a href="$0" target="_blank">$1</a>', $comment);
    return $comment;
}
开发者ID:hamaco,项目名称:phwittr-on-xoops,代码行数:15,代码来源:application.php

示例8: rss

 public function rss()
 {
     $this->layout = false;
     $this->response->setHeader("Content-Type", "application/rss+xml; charset=utf-8");
     $rss = new Sabel_Rss_Writer();
     $rss->setInfo(array("title" => "Phwittr public timeline", "language" => "ja"));
     $helper = new Helpers_Paginator_Status();
     $paginator = $helper->getPublicStatuses(array());
     if ($paginator->results) {
         foreach ($paginator->results as $item) {
             $rss->addItem(array("uri" => "http://" . $_SERVER["SERVER_NAME"] . uri("a: status, param: {$item->id}"), "title" => mb_strimwidth($item->User->user_name . ": " . $item->comment, 0, 35, "..."), "content" => $item->User->user_name . ": " . $item->comment, "date" => $item->created_at));
         }
     }
     $this->contents = $rss->output();
 }
开发者ID:hamaco,项目名称:phwittr-on-xoops,代码行数:15,代码来源:Index.php

示例9: bootstrap

 static function bootstrap()
 {
     // include libs
     $whichend = is_backend() ? 'backend' : 'frontend';
     // jquery-ui
     if (!Asset::checkAssetAdded('jquery-ui', 'js', $whichend)) {
         $js = "<script src='" . uri('libraries/jquery-ui/jquery-ui.min.js', false) . "'></script>";
         Asset::addDynamicAsset('jquery-ui', 'js', $whichend, $js);
     }
     if (!Asset::checkAssetAdded('jquery-ui', 'css', $whichend)) {
         $js = "<link rel=\"stylesheet\" href=\"" . uri('libraries/jquery-ui/jquery-ui.theme.min.css', false) . "\">";
         $js .= "\n<link rel=\"stylesheet\" href=\"" . uri('libraries/jquery-ui/jquery-ui.structure.min.css', false) . "\">";
         Asset::addDynamicAsset('jquery-ui', 'css', $whichend, $js);
     }
 }
开发者ID:jeffreycai,项目名称:ct21,代码行数:15,代码来源:FormWidgetDatepicker.class.php

示例10: render

 public function render($module, $model)
 {
     $rtn = "";
     $prepopulate = '($object->isNew() ? ' . "(isset(\$_POST['{$this->name}']) ? htmlentities(\$_POST['{$this->name}']) : '')" . ' : htmlentities($object->get' . format_as_class_name($this->name) . '()))';
     $rtn .= "\n<div class='form-group'>\r\n  <label for='{$this->name}'>{$this->name}</label>\r\n  <textarea class='form-control' rows='5' id='{$this->name}' name='{$this->name}'" . ($this->required ? ' required' : '') . ">[[[ echo {$prepopulate} ]]]</textarea>\r\n</div>\r\n";
     // ckeditor
     if ($this->wysiwyg) {
         if (!Asset::checkAssetAdded('ckeditor', 'js', 'backend')) {
             $js = "\n<script type='text/javascript' src='" . uri('libraries/ckeditor/ckeditor.js', false) . "'></script>\n";
             Asset::addDynamicAsset('ckeditor', 'js', 'backend', $js);
             $rtn .= $js;
         }
         $rtn .= "<script type='text/javascript'>CKEDITOR.replace('{$this->name}');</script>";
     }
     return $rtn;
 }
开发者ID:jeffreycai,项目名称:reader,代码行数:16,代码来源:FormWidgetTextarea.class.php

示例11: sendActivationKey

    public function sendActivationKey($recipient, $key)
    {
        $subject = "Phwittr本登録用メール";
        $body = <<<BODY
Phwittrへのご登録ありがとうございます。

Phwittrは「いまなにしてる?」という質問に短い文章で答えることによって、
友だちや家族、職場の同僚とつながり合うサービスです。

登録を完了するために下記のURLをクリックしてください。

http://%s
BODY;
        $body = sprintf($body, $_SERVER["SERVER_NAME"] . uri("c: register, a: auth, param: {$key}"));
        $this->send("register@" . $this->config["domain"], $recipient, $subject, $body);
    }
开发者ID:hamaco,项目名称:phwittr-on-xoops,代码行数:16,代码来源:Object.php

示例12: url

function url($params = array())
{
    if (count($params) == 0) {
        return 'http://' . host() . uri();
    } else {
        $url = 'http://' . host() . uri();
        $first = true;
        foreach ($params as $var => $val) {
            if ($first) {
                $url .= '?' . $var . '=' . $val;
                $first = false;
            } else {
                $url .= '&' . $var . '=' . $val;
            }
        }
        return $url;
    }
}
开发者ID:postfx,项目名称:fermion,代码行数:18,代码来源:app.php

示例13: render

 public function render($module, $model)
 {
     $rtn = "";
     $prepopulate = '($object->isNew() ? ' . "(isset(\$_POST['{$this->name}']) ? htmlentities(\$_POST['{$this->name}']) : '')" . ' : htmlentities($object->get' . format_as_class_name($this->name) . '()))';
     $rtn .= "\n<div class='form-group'>\r\n  <label class='col-sm-2 control-label' for='{$this->name}'>{$this->name} " . ($this->required ? $this->mandatory_field : '') . "</label>\r\n  <div class='col-sm-10'>\r\n    <textarea class='form-control' rows='5' id='{$this->name}' name='{$this->name}'" . ($this->required ? ' required' : '') . ">[[[ echo {$prepopulate} ]]]</textarea>\r\n  </div>\r\n</div>\r\n<div class='hr-line-dashed'></div>\r\n";
     // ckeditor
     if ($this->wysiwyg) {
         if (!Asset::checkAssetAdded('ckeditor', 'js', 'backend')) {
             $js = "\n<script type='text/javascript' src='" . uri('libraries/ckeditor/ckeditor.js', false) . "'></script>\n";
             Asset::addDynamicAsset('ckeditor', 'js', 'backend', $js);
             $rtn .= $js;
         }
         $toolbar = false;
         if ($this->wysiwyg_toolbar) {
             $toolbar_name = "TOOLBAR_" . strtoupper($this->wysiwyg_toolbar);
             $toolbar = constant("self::{$toolbar_name}");
         }
         $rtn .= "<script type='text/javascript'>CKEDITOR.replace('{$this->name}'" . ($toolbar ? ", {$toolbar}" : "") . ");</script>";
     }
     return $rtn;
 }
开发者ID:jeffreycai,项目名称:ct21,代码行数:21,代码来源:FormWidgetTextarea.class.php

示例14: login

 public function login()
 {
     $user = new User($this->param->user);
     $remember_me = $this->params->remember_me;
     if ($user->email && $user->password) {
         if ($user->load()) {
             if ($remember_me) {
                 $this->cookie('user_email', $user->email, time() + 60 * 60 * 24 * 30);
             }
             $this->session->user_id = $user->id;
             $this->session->user_name = $user->name;
         } else {
             $this->flash->now = t('FORGOT_PASSWORD_QUESTION', array('LINK' => uri("user/forgot_password?email={$user->email}")));
         }
     } else {
         // Logic goes here for missing user login details
     }
     $this->render->user = $user;
     return array($user);
     // for testing
 }
开发者ID:hutchike,项目名称:YAWF,代码行数:21,代码来源:User.php

示例15: out

 function out($content = array(), $header = null)
 {
     if (strtolower(uri(2)) == "xml") {
         header('Content-type: text/xml');
         echo $this->array2xml($content);
     } else {
         if (strtolower(uri(2)) == "json") {
             header('Content-Type: application/json');
             echo json_encode($content);
         } else {
             if (is_array($content) || is_object($content)) {
                 header('Content-Type: application/json');
                 echo json_encode($content);
             } else {
                 if (!is_null($header)) {
                     header('Content-Type: ' . $header);
                 }
                 echo $content;
             }
         }
     }
 }
开发者ID:gmathis96,项目名称:MailDud,代码行数:22,代码来源:controller_ajax.php


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