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.
私はApacheサーバー、Linuxを使用してPHPでWebアプリケーションを持っています。セキュリティ上の理由から、ドキュメントと画像を Web ルートの外に置いています。ユーザーがログインしたときに、これらの画像を表示するにはどうすればよいですか。
それと同じくらい簡単に、これは正しいヘッダーで画像を出力し ます。出力バッファーから何かをフラッシュする前に header() を設定する必要があることに注意してください => エコーまたは印刷前
$file = '../../somedirectory/image.jpg'; header('Content-Type:image/jpeg'); header('Content-Length: '.filesize($file)); echo file_get_contents($file);