本文整理汇总了PHP中URL::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::toString方法的具体用法?PHP URL::toString怎么用?PHP URL::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::toString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FileReader
function FileReader($file = NULL)
{
$fileobj = NULL;
if (!isset($file)) {
return;
}
if (URL::validClass($file)) {
$fileobj = $file;
$path = $fileobj->toString();
} else {
if (File::validClass($file)) {
$fileobj = $file;
$path = $fileobj->getFilePath();
} else {
$str = StringBuffer::toStringBuffer($file);
if ($str->startsWith('http://') || $str->startsWith('ftp://') || $str->startsWith('php://')) {
$fileobj = new URL($str);
$path = $fileobj->toString();
} else {
$fileobj = new File($file);
$path = $fileobj->getFilePath();
}
}
}
if (isset($fileobj)) {
$this->handle = @fopen($path, 'r');
if (isset($this->handle)) {
$this->file = $fileobj;
}
}
}
示例2: rewrite
static function rewrite(Location $l) {
$rv = Location::rewrite($l);
$u = new URL($rv);
$action = $u->query['action'];
unSet($u->query['action']);
$u->resource = $action;
return str_replace('?', '/', $u->toString());
}
示例3: rewrite
static function rewrite(Location $l) {
$rv = Location::rewrite($l);
$u = new URL($rv);
list($path, $res) = explode('?', $rv);
$res = base64_encode($res);
$u->query = array();
$u->resource = '';
return $u->toString() . $res;
}
示例4: equals
/**
* Tests whether two URLs are equal.
* Two URLs are equal if they have all fields equal, possibly except for ref
*
* @param mixed $url the url to compare to
* @return bool true if two locations are equal
*/
function equals($url) {
if (! ( $url instanceof URL))
$url = new URL($url);
return $url->isWellformed() && $this->isWellformed() && ($this->toString(false) === $url->toString(false));
}
示例5: isSealed
public function isSealed(URL $url)
{
if ($this->sealBase->toString() == $url->toString()) {
return true;
}
return false;
}
示例6: toString
/** @return string */
public function toString()
{
return $this->url ? $this->url->toString() : $this->path;
}