本文整理汇总了PHP中Zend\Http\PhpEnvironment\Request::getRequestUri方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getRequestUri方法的具体用法?PHP Request::getRequestUri怎么用?PHP Request::getRequestUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Http\PhpEnvironment\Request
的用法示例。
在下文中一共展示了Request::getRequestUri方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executar
/**
* Metodo padrão de execução do log
*
* @return Log
*/
public function executar()
{
$this->logArquivo->parse();
$this->logArquivo->getLog()->setInicio(new \Datetime());
$this->logArquivo->getLog()->setFim(new \Datetime());
$this->logArquivo->getLog()->setIp($this->request->getServer('REMOTE_ADDR'));
$this->logArquivo->getLog()->setMensagem('Log arquivo de ' . $this->logArquivo->getTipo() . ': ' . $this->logArquivo->getNome());
$this->logArquivo->getLog()->setTipo(LogArquivo::TIPO);
$this->logArquivo->getLog()->setUsuario($this->usuario);
$this->logArquivo->getLog()->setRoute($this->request->getRequestUri());
return $this->logArquivo->getLog();
}
示例2: executar
/**
* Metodo padrão de execução do log
*
* @return Log
*/
public function executar()
{
$this->logCadastro->setOperacao($this->operacao);
$this->logCadastro->parse();
$this->logCadastro->getLog()->setInicio(new \Datetime());
$this->logCadastro->getLog()->setFim(new \Datetime());
$this->logCadastro->getLog()->setIp($this->request->getServer('REMOTE_ADDR'));
$this->logCadastro->getLog()->setMensagem($this->operacao . ' - ' . get_class($this->logCadastro->getEntity()));
$this->logCadastro->getLog()->setTipo(LogCadastro::TIPO);
$this->logCadastro->getLog()->setUsuario($this->usuario);
$this->logCadastro->getLog()->setRoute($this->request->getRequestUri());
return $this->logCadastro->getLog();
}
示例3: __construct
public function __construct(Request $request)
{
$uri = substr($request->getRequestUri(), strlen($request->getBaseUrl()));
if ($pos = strpos($uri, '?')) {
$uri = substr($uri, 0, $pos);
}
$this->path = array_filter(explode('/', trim($uri, '/')));
$this->config = (new Routes())->routesMap;
$this->module = $this->getModule();
$this->dir = $this->config[$this->module];
}
示例4: __invoke
/**
* This function will generate all meta tags needed for SEO optimisation.
*
* @param array $content
*/
public function __invoke(array $content = [])
{
$description = !empty($content['description']) ? $content['description'] : $this->settings->__invoke('general', 'site_description');
$keywords = !empty($content['keywords']) ? $content['keywords'] : $this->settings->__invoke('general', 'site_keywords');
$text = !empty($content['text']) ? $content['text'] : $this->settings->__invoke('general', 'site_text');
$preview = !empty($content['preview']) ? $content['preview'] : '';
$title = !empty($content['title']) ? $content['title'] : $this->settings->__invoke('general', 'site_name');
$this->placeholder->append("\r\n<meta itemprop='name' content='" . $this->settings->__invoke('general', 'site_name') . "'>\r\n");
// must be set from db
$this->placeholder->append("<meta itemprop='description' content='" . substr(strip_tags($text), 0, 150) . "'>\r\n");
$this->placeholder->append("<meta itemprop='title' content='" . $title . "'>\r\n");
$this->placeholder->append("<meta itemprop='image' content='" . $preview . "'>\r\n");
$this->headMeta->appendName('keywords', $keywords);
$this->headMeta->appendName('description', $description);
$this->headMeta->appendName('viewport', 'width=device-width, initial-scale=1.0');
$this->headMeta->appendName('generator', $this->settings->__invoke('general', 'site_name'));
$this->headMeta->appendName('apple-mobile-web-app-capable', 'yes');
$this->headMeta->appendName('application-name', $this->settings->__invoke('general', 'site_name'));
$this->headMeta->appendName('mobile-web-app-capable', 'yes');
$this->headMeta->appendName('HandheldFriendly', 'True');
$this->headMeta->appendName('MobileOptimized', '320');
$this->headMeta->appendName('apple-mobile-web-app-status-bar-style', 'black-translucent');
$this->headMeta->appendName('author', 'Stanimir Dimitrov - stanimirdim92@gmail.com');
$this->headMeta->appendName('twitter:card', 'summary');
$this->headMeta->appendName('twitter:site', '@' . $this->settings->__invoke('general', 'site_name'));
$this->headMeta->appendName('twitter:title', substr(strip_tags($title), 0, 70));
// max 70 chars
$this->headMeta->appendName('twitter:description', substr(strip_tags($text), 0, 200));
$this->headMeta->appendName('twitter:image', $preview);
// max 1MB
$this->headMeta->appendProperty('og:image', $preview);
$this->headMeta->appendProperty('og:title', $title);
$this->headMeta->appendProperty('og:description', $description);
$this->headMeta->appendProperty('og:type', 'article');
$this->headMeta->appendProperty('og:url', $this->request->getUri()->getHost() . $this->request->getRequestUri());
}
示例5: testServerHostnameProvider
/**
* @dataProvider serverHostnameProvider
* @param array $server
* @param string $name
* @param string $value
*/
public function testServerHostnameProvider(array $server, $expectedHost, $expectedRequestUri)
{
$_SERVER = $server;
$request = new Request();
$host = $request->getUri()->getHost();
$this->assertEquals($expectedHost, $host);
$requestUri = $request->getRequestUri();
$this->assertEquals($expectedRequestUri, $requestUri);
}
示例6: createId
/**
* Determine the page to save from the request
*
* @param HttpRequest $request Http Request
*
* @throws \RuntimeException
* @return string
*/
protected function createId(HttpRequest $request)
{
return md5(sprintf('%s-%s-%s', $request->getServer('HTTPS'), $request->getServer('HTTP_HOST'), $request->getRequestUri()));
}
示例7: testServerHostnameProvider
/**
* @dataProvider serverHostnameProvider
* @param array $server
* @param string $name
* @param string $value
*/
public function testServerHostnameProvider(array $server, $expectedHost, $expectedPort, $expectedRequestUri)
{
$_SERVER = $server;
$request = new Request();
$host = $request->getUri()->getHost();
$this->assertEquals($expectedHost, $host);
$uriParts = parse_url($_SERVER['REQUEST_URI']);
if (isset($uriParts['scheme'])) {
$scheme = $request->getUri()->getScheme();
$this->assertEquals($uriParts['scheme'], $scheme);
}
$port = $request->getUri()->getPort();
$this->assertEquals($expectedPort, $port);
$requestUri = $request->getRequestUri();
$this->assertEquals($expectedRequestUri, $requestUri);
}