本文整理汇总了PHP中LocalFile::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP LocalFile::getUrl方法的具体用法?PHP LocalFile::getUrl怎么用?PHP LocalFile::getUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalFile
的用法示例。
在下文中一共展示了LocalFile::getUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFreshURL
public function getFreshURL($name, $definedName)
{
$title = Title::newFromText($definedName, NS_FILE);
if ($definedName != $name) {
$file = OldLocalFile::newFromArchiveName($title, RepoGroup::singleton()->getLocalRepo(), $name);
return wfReplaceImageServer($file->getUrl());
} else {
$file = new LocalFile($title, RepoGroup::singleton()->getLocalRepo());
return wfReplaceImageServer($file->getUrl());
}
}
示例2: checkImage
private function checkImage(LocalFile $image, $fileHash)
{
$hash = md5($image->getName());
$url = $image->getUrl();
$this->assertStringEndsWith(sprintf('/%s/images/%s/%s/%s', $this->app->wg->DBname, $hash[0], $hash[0] . $hash[1], urlencode($image->getName())), $url, 'Path should contain a valid hash');
// verify that it's accessible via HTTP
$req = MWHttpRequest::factory($url, ['noProxy' => true]);
$req->execute();
$this->assertEquals(200, $req->getStatus(), 'Uploaded image should return HTTP 200 - ' . $url);
$this->assertEquals($fileHash, md5($req->getContent()), 'Uploaded image hash should match - ' . $url);
$this->assertEquals('image/jpeg', $req->getResponseHeader('Content-Type'), 'Uploaded image should be JPEG');
}