배열에있는 폴더에서 파일을 얻는 것을 도우십시오. array
에있는 모든 jpg 파일 이름을 images
폴더에서 가져 오려고합니다. 그 후 rand
을 사용하면 CSS 배경을 임의로 변경할 수 있습니다.PHP 배열로 폴더에서 jpg 파일을 얻으십시오
arry의 폴더에있는 JPG 파일.
$images=array("image1.jpg", "image2.jpg");
는 배열을 얻을 수
$images = glob("images/*.jpg");
// may want to verify that the $images array has elements before echoing
echo '<style>body{background:url('.$images[array_rand($images)].') no-repeat;';
Sooo ... 뭐가 문제입니까? 당신이 시도한 바가 부적절한가? –
배열의 폴더에서 파일을 가져 오는 방법을 모른다. –
[Manual is your friend] (http://php.net/manual/en/function.readdir.php) - williamcomartin이 작성한 gmail dot com의 함수 찾기 – Peter