Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.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数据输入<;链接rel=";样式表“;类型=";text/css“;href=";CSS/sheet.CSS“/&燃气轮机;_Php_Css_Xhtml_Mysqli - Fatal编程技术网

如何将PHP数据输入<;链接rel=";样式表“;类型=";text/css“;href=";CSS/sheet.CSS“/&燃气轮机;

如何将PHP数据输入<;链接rel=";样式表“;类型=";text/css“;href=";CSS/sheet.CSS“/&燃气轮机;,php,css,xhtml,mysqli,Php,Css,Xhtml,Mysqli,我有一个脚本,可以成功地显示操作系统和浏览器。我已经使它输出一个css脚本。它将输出分解为八个CSS脚本。(目前)这显示Mac、PC和Ubuntu操作系统以IE、Firefox、Safari和Chrome为主要浏览器。这个剧本还处于初级阶段,但现在还可以用。我稍后会把它清理干净 请不要告诉我get_browser()工作得更好,我使用的服务器不允许它工作 CSS列表如下所示: <?php //Written by Matt Ridge //Kaboom Labs LLC. //Web Si

我有一个脚本,可以成功地显示操作系统和浏览器。我已经使它输出一个css脚本。它将输出分解为八个CSS脚本。(目前)这显示Mac、PC和Ubuntu操作系统以IE、Firefox、Safari和Chrome为主要浏览器。这个剧本还处于初级阶段,但现在还可以用。我稍后会把它清理干净

请不要告诉我get_browser()工作得更好,我使用的服务器不允许它工作

CSS列表如下所示:

<?php
//Written by Matt Ridge
//Kaboom Labs LLC.
//Web Site to be Announced.
//This is a script that will identify the OS and browser you are using. This also has a fix in where Chrome shows up as Chrome, and not show up as Safari by accident. 



//Booleans to set OS and Browser to False.
$os = false;
$browser = false;
//Booleans for Web Browser & OS Functions.
$info = $_SERVER['HTTP_USER_AGENT'];
$xp = 'Windows NT 5.1';
$vista = 'Windows NT 6.0';
$win7 = 'Windows NT 6.1';
$ubuntu = 'Ubuntu';
$ie106 = 'ie106';
$ie10 = 'ie10';
$ie9 = 'ie9';
$ie8 = 'MSIE 8.0;';
$ie7b = 'MSIE 7.0b;';
$ie7 = 'MSIE 7.0;';
$chrome = '/Chrome/';
$safari = '/Safari/';
$firefox = '/Firefox/';


//Operating Systems
if (stristr($info, "Windows NT 5.1")) {echo 'post';}
if (stristr($info, "Windows NT 6.0")) {echo 'post';}
if (stristr($info, "Windows NT 6.1")) {echo 'post';}
if (stristr($info, "Ubuntu")) {echo 'postu';}
if (stristr($info, "Mac OS")) {echo 'postm';}


//Web Browsers
if (stristr($info, "Chrome") !== FALSE) {stristr($info,"Safari");
        $chrome = 'cr.css';
            echo 'cr.css';}
elseif (stristr($info, "Safari")) {echo 'sa.css';}
if (stristr($info, "Firefox")) {echo 'ff.css';}
if (stristr($info, "MSIE 7.0;")) {echo 'ie.css';}
if (stristr($info, "MSIE 7.0b;")) {echo 'ie.css';}
if (stristr($info, "MSIE 8.0;")) {echo 'ie.css';}
if (stristr($info, "MSIE 9.0;")) {echo 'ie.css';}
if (stristr($info, "MSIE 10.0;")) {echo 'ie.css';}
if (stristr($info, "MSIE 10.6;")) {echo 'ie.css';}



//If OS or Browser not found in list.
if ($ubuntu || $xp || $vista || $win7)
$os = true;

if($firefox || $chrome || $safari || $ie106 || $ie10 || $ie9 || $ie8 || $ie7b || $ie7)
$browser = true;

if(!$browser || !$os){

echo'<strong>';
echo '<br />' . $_SERVER['HTTP_USER_AGENT'] . '<br /><br />Administrator someone in your work force is using an unsupported browser or OS, please email this information to the developer of the web page you are using. It will allow your browser/OS combination  to be used correctly. Sorry for the inconvenience.</strong> <br /><br />Please copy and paste the text above and send it to your web administrator. It will explain everything he/she needs to do.<br />';}

?>
  • 邮政编码
  • postff.css
  • poste.css
  • postcr.css
  • postff.css
  • postmsa.css
  • postsc.css
  • postoff.css
脚本如下所示:

<?php
//Written by Matt Ridge
//Kaboom Labs LLC.
//Web Site to be Announced.
//This is a script that will identify the OS and browser you are using. This also has a fix in where Chrome shows up as Chrome, and not show up as Safari by accident. 



//Booleans to set OS and Browser to False.
$os = false;
$browser = false;
//Booleans for Web Browser & OS Functions.
$info = $_SERVER['HTTP_USER_AGENT'];
$xp = 'Windows NT 5.1';
$vista = 'Windows NT 6.0';
$win7 = 'Windows NT 6.1';
$ubuntu = 'Ubuntu';
$ie106 = 'ie106';
$ie10 = 'ie10';
$ie9 = 'ie9';
$ie8 = 'MSIE 8.0;';
$ie7b = 'MSIE 7.0b;';
$ie7 = 'MSIE 7.0;';
$chrome = '/Chrome/';
$safari = '/Safari/';
$firefox = '/Firefox/';


//Operating Systems
if (stristr($info, "Windows NT 5.1")) {echo 'post';}
if (stristr($info, "Windows NT 6.0")) {echo 'post';}
if (stristr($info, "Windows NT 6.1")) {echo 'post';}
if (stristr($info, "Ubuntu")) {echo 'postu';}
if (stristr($info, "Mac OS")) {echo 'postm';}


//Web Browsers
if (stristr($info, "Chrome") !== FALSE) {stristr($info,"Safari");
        $chrome = 'cr.css';
            echo 'cr.css';}
elseif (stristr($info, "Safari")) {echo 'sa.css';}
if (stristr($info, "Firefox")) {echo 'ff.css';}
if (stristr($info, "MSIE 7.0;")) {echo 'ie.css';}
if (stristr($info, "MSIE 7.0b;")) {echo 'ie.css';}
if (stristr($info, "MSIE 8.0;")) {echo 'ie.css';}
if (stristr($info, "MSIE 9.0;")) {echo 'ie.css';}
if (stristr($info, "MSIE 10.0;")) {echo 'ie.css';}
if (stristr($info, "MSIE 10.6;")) {echo 'ie.css';}



//If OS or Browser not found in list.
if ($ubuntu || $xp || $vista || $win7)
$os = true;

if($firefox || $chrome || $safari || $ie106 || $ie10 || $ie9 || $ie8 || $ie7b || $ie7)
$browser = true;

if(!$browser || !$os){

echo'<strong>';
echo '<br />' . $_SERVER['HTTP_USER_AGENT'] . '<br /><br />Administrator someone in your work force is using an unsupported browser or OS, please email this information to the developer of the web page you are using. It will allow your browser/OS combination  to be used correctly. Sorry for the inconvenience.</strong> <br /><br />Please copy and paste the text above and send it to your web administrator. It will explain everything he/she needs to do.<br />';}

?>

脚本将告诉用户复制并粘贴一条语句,以防他们使用不受支持的浏览器,因此脚本管理员可以更新代码

我想做的是在这里输出这个脚本:

<link rel="stylesheet" type="text/css" href="CSS/sheet.css" />

我希望它用上面脚本的输出替换sheet.css

我是这样写的:

<link rel="stylesheet" type="text/css" href="CSS/<?php require ('css.php');?>" />

它实际创建的路径是:

/CSS/%EF%BB%BFpostcr.css
在文件中设置一个变量可能会容易得多。这样你就不必担心任何无关的数据通过

//in the included file (shortened obviously)
$myCSS = '';
$myCSS .= 'post';
$myCSS .= 'cr.css';

//in the displaying file
... href="/CSS/<?php echo $myCSS; ?>"> ...
//在包含的文件中(明显缩短)
$myCSS='';
$myCSS.='post';
$myCSS.='cr.css';
//在显示文件中
... href=“/CSS/”>。。。

CSS有什么特别之处,您为每个浏览器都编写了一个CSS?使用一个版本,支持所有浏览器。你未来的用户会很感激的。什么是回音?(或者错误是什么?)这当然是可能的,而且你做得很好——可能只是没有得到你想要的结果,或者没有使用正确的文件路径……等等。为什么每个操作系统/浏览器组合都有不同的样式表?我很奇怪为什么有人会这么做……把你所有的东西都放在css.php中的一个名为lets say determinecss()的函数中,这里是…@MattRidge我知道这个问题的重点不是你是否应该这样做,但据我所知,创建跨浏览器代码并没有那么复杂,浏览器中的视觉效果很少改变(IE或某些CSS(如CSS3)除外,但仍会降级)。重要的是结构,所有浏览器都可以访问相同的内容。而且不需要8个CSS文件就可以完成。好的,文件存在,我遇到的问题是,你应该看到的背景颜色是浅蓝色。而不是白色。这很奇怪,因为它与相应的文件一起存在。看起来是这样的在href属性中有一些不可见的ascii字符。@JanWesterdiep对了,这让我很困惑。using在css文件夹中显示了您要使用的css文件,它在上面的列表中。但是它没有发布,我也不知道为什么。我也不能,但是当我将href属性更改为“css/postff.css”时使用Firebug,我得到了正确的css文件(蓝色背景)。你到底在回显什么?