本文整理匯總了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');
}