本文整理汇总了PHP中HttpRequest::getUri方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpRequest::getUri方法的具体用法?PHP HttpRequest::getUri怎么用?PHP HttpRequest::getUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpRequest
的用法示例。
在下文中一共展示了HttpRequest::getUri方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* 呼朋唤友首页
*/
public function index ()
{
$params = array();
$params['isPage'] = true;
$params['pageSize'] = 5;
$params['fields'] = 'id, wx_name, wx_img, create_time';
$params['invitation_open_id'] = $this->_openId;
$result = $this->model->getList($params);
// 获得合伙人二维码信息
$invitationQrcModel = loadModel('Index.InvitationQrc');
$qrInfo = $invitationQrcModel->getQrimg($this->_openId);
// 设置分享参数
$shareParams = array(
'shareTitle' => '我只说一句来,你就可投怀送抱',
'shareDesc' => '集齐好友,即可召唤5100极地冰泉靓颜术!',
'shareImg' => HttpRequest::getUri() . '/Public/Index/images/lnvitation_share.jpg',
'shareUrl' => url('Invitation', 'share', array('open_id' => $this->_openId), 'index.php'),
);
$this->setShare($shareParams);
$this->assign('data', $result);
$this->assign('qrInfo', $qrInfo);
$this->display('Index.Invitation.index');
}
示例2: threadmain
function threadmain()
{
// Read request block
$buf = "";
while (true) {
$rl = socket_read($this->sock, 4096, PHP_BINARY_READ);
if (false == $rl) {
socket_close($this->sock);
return;
} else {
$buf = $buf . $rl;
}
if (strpos($buf, "\r\n\r\n")) {
break;
} else {
console::writeLn('%s', $buf);
}
}
$db = explode("\r\n\r\n", $buf);
$data = $db[0];
// Put back the rest of the buffer for posts etc
$buf = join('', array_slice($db, 1));
$request = new HttpRequest($data);
// data
$response = new HttpResponse();
// Pop the header off the buffer
$status = call_user_func_array($this->handler, array(&$request, &$response));
if ($status == 0) {
$status = 200;
}
$peer = "";
$port = 0;
socket_getpeername($this->sock, $peer, $port);
console::writeLn("%s %s:%d %d %s", $request->getMethod(), $peer, $port, $status, $request->getUri());
$response->writeHeaders($this->sock, 200);
$response->writeContent($this->sock);
socket_shutdown($this->sock, 2);
usleep(50000);
socket_close($this->sock);
}
示例3: url
<h1 class="logo left">惠氏后台管理系统</h1>
</div>
</div>
<div class="container clearfix ">
<div class="login-con">
<div class="login-form">
<form id="submit" action="" method="post">
<p class="login-form-box">
<label for="">用户名:</label><input type="text" name="username" id="username" >
</p>
<p class="login-form-box">
<label for="">密 码:</label><input name="password" id="password" type="password">
</p>
<p class="login-form-box">
<label for="">验证码</label><input style="width:130px;margin-right: 20px;" name="verify" id="verify" type="text" />
<span style="float:right;"><img src='<?php echo HttpRequest::getUri(); ?>/admin.php?a=Index&m=verify' id="imgs" style="cursor:pointer;width:90px;"/></span>
</p>
<p class="clearfix"></p>
<p class="clearfix">
<label for="remember" class="login-form-chk left"><span></span></label>
<input type="hidden" name="dopost">
<input type="submit" class="btn btn-success btn-xxl right js_loginBtn" value=" 登 录 ">
</p>
</form>
</div>
</div>
<script>
$(function () {
var url = "<?php echo url('Index', 'verify', array(), 'admin.php'); ?>";
示例4: testRequest
/**
* Request test.
* @return void
*/
public function testRequest()
{
$_SERVER = array('HTTPS' => 'On', 'HTTP_HOST' => 'nettephp.com:8080', 'QUERY_STRING' => 'x param=val.&pa%%72am=val2¶m3=v%20a%26l%3Du%2Be)', 'REMOTE_ADDR' => '192.168.188.66', 'REQUEST_METHOD' => 'GET', 'REQUEST_URI' => '/file.php?x param=val.&pa%%72am=val2¶m3=v%20a%26l%3Du%2Be)', 'SCRIPT_FILENAME' => '/public_html/www/file.php', 'SCRIPT_NAME' => '/file.php');
$request = new HttpRequest();
$request->addUriFilter('%20', '', PHP_URL_PATH);
$request->addUriFilter('[.,)]$');
$this->assertEquals('GET', $request->getMethod());
$this->assertEquals(TRUE, $request->isSecured());
$this->assertEquals('192.168.188.66', $request->getRemoteAddress());
$this->assertEquals('/file.php', $request->getUri()->scriptPath);
$this->assertEquals('https', $request->getUri()->scheme);
$this->assertEquals('', $request->getUri()->user);
$this->assertEquals('', $request->getUri()->pass);
$this->assertEquals('nettephp.com', $request->getUri()->host);
$this->assertEquals(8080, $request->getUri()->port);
$this->assertEquals('/file.php', $request->getUri()->path);
$this->assertEquals("pa%ram=val2¶m3=v a%26l%3Du%2Be&x param=val.", $request->getUri()->query);
$this->assertEquals('', $request->getUri()->fragment);
$this->assertEquals('nettephp.com:8080', $request->getUri()->authority);
$this->assertEquals('https://nettephp.com:8080', $request->getUri()->hostUri);
$this->assertEquals('https://nettephp.com:8080/', $request->getUri()->baseUri);
$this->assertEquals('/', $request->getUri()->basePath);
$this->assertEquals('file.php', $request->getUri()->relativeUri);
$this->assertEquals("https://nettephp.com:8080/file.php?pa%ram=val2¶m3=v a%26l%3Du%2Be&x param=val.", $request->getUri()->absoluteUri);
$this->assertEquals('', $request->getUri()->pathInfo);
$this->assertEquals('https', $request->getOriginalUri()->scheme);
$this->assertEquals('', $request->getOriginalUri()->user);
$this->assertEquals('', $request->getOriginalUri()->pass);
$this->assertEquals('nettephp.com', $request->getOriginalUri()->host);
$this->assertEquals(8080, $request->getOriginalUri()->port);
$this->assertEquals('/file.php', $request->getOriginalUri()->path);
$this->assertEquals('x param=val.&pa%%72am=val2¶m3=v%20a%26l%3Du%2Be)', $request->getOriginalUri()->query);
$this->assertEquals('', $request->getOriginalUri()->fragment);
$this->assertEquals('val.', $request->getQuery('x_param'));
$this->assertEquals('val2', $request->getQuery('pa%ram'));
$this->assertEquals('v a&l=u+e', $request->getQuery('param3'));
$this->assertEquals('', $request->getPostRaw());
$this->assertEquals('nettephp.com:8080', $request->headers['host']);
}
示例5:
<ul class="sidenav2">
<li <?php
if ($_GET['m'] == "memberCard") {
echo 'class="curr"';
}
?>><a href="<?php echo HttpRequest::getUri(); ?>/admin.php?a=index&m=memberCard">企业会员卡</a></li>
<li <?php
if ($_GET['m'] == "userMemberCard") {
echo 'class="curr"';
}
?>><a href="<?php echo HttpRequest::getUri(); ?>/admin.php?a=index&m=userMemberCard">用户会员卡</a></li>
<li <?php
if ($_GET['m'] == "creditChangeRecord") {
echo 'class="curr"';
}
?>><a href="<?php echo HttpRequest::getUri(); ?>/admin.php?a=index&m=creditChangeRecord">积分变更记录</a></li>
</ul>
</li>
</ul>
</div>
<script>
$(function () {
$('.js_topMenu').click(function (e) {
var s = e.target || e.srcElement;
if ($(s).parents(".sidenav2").size() > 0) {
return;
}
$(this).siblings().removeClass('curr')
$(this).siblings().find('ul:visible').slideUp();
if (!$(this).find('ul:visible').length) {
示例6: url
function url($action = null, $method = null, $params = array(), $prefixUrl = null) {
$params[SuiShiPHPConfig::ACTION_NAME] = $action;
$params[SuiShiPHPConfig::METHOD_NAME] = $method;
$query = http_build_query($params);
if(!isset($prefixUrl) || $prefixUrl == null){
return HttpRequest::getUri(). '/index.php' . ($query ? '?'.$query : '');
}else{
$prefixUrl = ltrim($prefixUrl,'/');
return resetUrl(HttpRequest::getUri(). '/'.$prefixUrl,$params);
}
}