Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php iPad和iPhone上未显示身体背景图像_Php_Iphone_Html_Css_Ipad - Fatal编程技术网

Php iPad和iPhone上未显示身体背景图像

Php iPad和iPhone上未显示身体背景图像,php,iphone,html,css,ipad,Php,Iphone,Html,Css,Ipad,我创建了一个在桌面上运行良好的网站,但在iPhone和iPad上没有显示背景图像 我已经尝试删除选择图像的php脚本,并重新编写代码以使用javascript设置背景,在本例中,背景显示正确 这是选择图像的php代码: <?php //if doesn't exist, open the session if(!isset($_SESSION)) { session_start(); } //set coockie setcookie("allweb","connected",

我创建了一个在桌面上运行良好的网站,但在iPhone和iPad上没有显示背景图像

我已经尝试删除选择图像的php脚本,并重新编写代码以使用javascript设置背景,在本例中,背景显示正确

这是选择图像的php代码:

<?php
//if  doesn't exist, open the session
if(!isset($_SESSION))
{
    session_start();
}
//set coockie
setcookie("allweb","connected", time()+3600);
//if doesn' exist yet, I create a new array
if(!isset($_SESSION['arrayImage'])){
    $arrayImage = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
}else{// else I get from sessiom
    $arrayImage = $_SESSION['arrayImage'];  
}
//if already exist variable $picture, increment it
if(isset($_SESSION['picture']) && isset($arrayImage)){
    $picture=$_SESSION['picture'];
    $picture = $picture + 1;
    $_SESSION['picture'] = $picture;//save picture
}else{// else I create it
    $picture = 1;
    $_SESSION['picture'] = $picture;// save it
    shuffle($arrayImage);// I shuffle the array
    $_SESSION['arrayImage'] = $arrayImage;//save array to the session
}
?>

我想您已经检查了输出,它是正确的。
如果是这种情况,请尝试删除背景url周围的引号:

body {background-image:url("images/bg'.$arrayImage[$picture].'hq.jpg");}

顺便说一句,使用它们是绝对有效的,但这是非常罕见的,而且iOS的Webkit呈现程序有时喜欢产生一些非常错误的结果,即使使用有效的标记。不幸的是,它不同于Android的Webkit渲染器或任何x86 Webkit引擎,因此如果没有非常昂贵的苹果设备,这些问题是无法复制和深入检查的


使用JS进行的CSS修改,特别是使用框架(例如jQuery)进行的CSS修改,通常会被智能地解析,从而在需要时进行语法更正,这就是为什么这些引号是我的主要怀疑点。

嗨,Martin,请根据问题和答案编辑您的姓名和工作场所。我可能会来喝杯咖啡,因为我住在这条路的尽头,但我们不在这里做广告——如果我们这样做,就必须有免责声明。祝你好运
body {background-image:url("images/bg'.$arrayImage[$picture].'hq.jpg");}
body {background-image:url(images/bg'.$arrayImage[$picture].'hq.jpg);}