本文整理匯總了PHP中Storage::fetchExternalUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP Storage::fetchExternalUrl方法的具體用法?PHP Storage::fetchExternalUrl怎麽用?PHP Storage::fetchExternalUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Storage
的用法示例。
在下文中一共展示了Storage::fetchExternalUrl方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkUrl
public static function checkUrl($url)
{
return Storage::fetchExternalUrl($url);
//return ContextualizationScripts::fetchUrl($url);
}
示例2: urlAction
public function urlAction()
{
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
return;
}
$url = isset($_POST['url']) ? trim($_POST['url']) : null;
if ($url === null) {
echo '{"error":"Invalid request"}';
return;
}
try {
$guid = isset($_POST['guid']) ? $_POST['guid'] : uniqid();
$data = Storage::fetchExternalUrl($url, $guid);
$name = $name = isset($data['name']) && trim($data['name']) !== "" ? trim($data['name']) : uniqid();
$name = Storage::escapeFileName($name);
echo '{"url" : "' . DIRECTORY_SEPARATOR . $guid . DIRECTORY_SEPARATOR . $name . '", "name" : "' . $name . '", "md5":"' . $data['md5'] . '", "size":"' . $data['size'] . '"}';
} catch (Exception $ex) {
$res = array("error" => $ex->getMessage());
echo json_encode($res);
return;
}
}