【发布时间】:2013-09-06 23:41:36
【问题描述】:
我正在使用 Wordpress 主题,并希望让它自动更改背景图像。因此,我使用了一些 PHP 代码并尝试将其构建到网站中,但有些东西不起作用,我无法弄清楚,因为我对 PHP 不是很好。
functions.php:
<?php
$bilder = glob( "images/*.jpg" );
shuffle( $bilder );
$zufall = imagecreatefromjpeg($bilder[0]);
imagejpeg($zufall);
?>
...而且只是在我的 Wordpress 的 CSS 中:
body {
background: url('<?php print $zufall ?>') no-repeat center center fixed;
}
但由于某种原因,它只是没有显示图片,我现在真的不了解我的智慧了。 :(
你能帮我或告诉我错误吗?
非常感谢您。
【问题讨论】:
标签: php css image wordpress background