Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
URLからサーバーにファイルをコピーするサイトがあります。コピー後にファイルのSHAを取得する方法が必要です。
私は@copy($url,$upload_path)ファイルをコピーするために使用していましたが、これはブール値を返します。ファイルを返すものが必要です。そのようなものはありますか?
@copy($url,$upload_path)
後でファイルを取得する必要がありますsha1_file($file)
sha1_file($file)
感謝!
あなたはただすることができます
if (@copy($url,$upload_path)) { $hash = sha1_file($upload_path); }
$upload_pathに渡す必要のある値がすでに含まれていますsha1_file()。
$upload_path
sha1_file()
そして、原則として、@オペレーターは悪です。この特定の使用法は間違いなく有効ですが、経験則として、最後の手段として扱う必要があります。
@