本文整理汇总了PHP中Environment::uriComponents方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::uriComponents方法的具体用法?PHP Environment::uriComponents怎么用?PHP Environment::uriComponents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::uriComponents方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDispatch
/**
* @test
* @profile
*/
public function testDispatch()
{
split_time('reset');
Rest_Test_Unit_Case_Resource_Foo::serve('resource/foo');
split_time('Invoke Rest_Test_Unit_Case_Resource_Foo::serve(resource/foo)');
Http_Scriptlet_Context::push(new Http_Scriptlet_Context(Environment::uriComponents()));
split_time('Initialize Components\\Http_Scriptlet_Context');
$uri = Uri::valueOf(Environment::uriComponents('rest', 'resource', 'foo', 'poke', '1234.json'));
split_time("Invoke Uri::valueOf({$uri})");
ob_start();
split_time('reset');
Http_Scriptlet_Context::current()->dispatch($uri, Http_Scriptlet_Request::METHOD_GET);
split_time("Invoke Components\\Http_Scriptlet_Context\$dispatch([{$uri}], GET)");
$result = ob_get_clean();
assertEquals(json_encode(true), $result);
split_time('reset');
$uri = Uri::valueOf(Environment::uriComponents('rest', 'resource', 'foo', 'poke', '1234.json'));
$uri->setQueryParam('log', 'false');
split_time("Invoke Uri::valueOf({$uri})");
ob_start();
split_time('reset');
Http_Scriptlet_Context::current()->dispatch($uri, Http_Scriptlet_Request::METHOD_GET);
split_time("Invoke Components\\Http_Scriptlet_Context\$dispatch([{$uri}], GET)");
$result = ob_get_clean();
assertEquals(json_encode(false), $result);
}
示例2: uriForPath
/**
* @param string $image_
*
* @return \Components\Uri
*/
public static function uriForPath($image_)
{
$extension = Io::fileExtension($image_);
$key = md5($image_);
Cache::set($key, $image_);
return Environment::uriComponents('ui', 'image', "{$key}.{$extension}");
}
示例3: uriByScheme
/**
* @see \Components\Media_Storage::uriByScheme() \Components\Media_Storage::uriByScheme()
*/
public function uriByScheme($scheme_, $id_, $category_ = null)
{
if (@is_file(Environment::pathResource("{$this->store->path}/{$scheme_}/{$category_}/{$id_}"))) {
return "{$this->store->uri}/{$scheme_}/{$category_}/{$id_}";
}
// TODO (CSH) Http_Scriptlet_Router
return Environment::uriComponents(sprintf('media/image/%1$s%2$s', \str\encodeBase64Url(serialize(array($this->store->path, $id_, $category_, $scheme_))), substr($id_, strrpos($id_, '.'))));
}