Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.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 要显示的特定于设备的内容_Php_Android_Ios - Fatal编程技术网

Php 要显示的特定于设备的内容

Php 要显示的特定于设备的内容,php,android,ios,Php,Android,Ios,我正在建立一个站点()并在此站点上有一个类别列表 该页面上的每个类别都链接到我的数据库中的一个项目。单击后将显示更多内容 我在同一个数据库中有一个单独的数据库表单,叫做apps(而不是mobi)。在这里面我有一个可用的应用程序列表,但有些应用程序是为选定的设备 例如,一些应用程序链接到google play,只能在android设备上显示,因为在其他设备(例如ios)上显示这些应用程序可能被视为毫无意义 在iPhone和android上显示iPad应用程序也是如此,因为这些应用程序被视为毫无意义

我正在建立一个站点()并在此站点上有一个类别列表

该页面上的每个类别都链接到我的数据库中的一个项目。单击后将显示更多内容

我在同一个数据库中有一个单独的数据库表单,叫做apps(而不是mobi)。在这里面我有一个可用的应用程序列表,但有些应用程序是为选定的设备

例如,一些应用程序链接到google play,只能在android设备上显示,因为在其他设备(例如ios)上显示这些应用程序可能被视为毫无意义

在iPhone和android上显示iPad应用程序也是如此,因为这些应用程序被视为毫无意义

该设备保存在“设备”字段下的my apps数据库中,并具有以下类别之一:iPhone iPad或android

我想要的是在我的索引页面上显示一个类别,旁边是我的其他类别,上面写着“应用程序下载”。点击后,它只显示可用的相关应用程序,就像我当前在网站上的促销一样

但我只希望链接出现在这些设备中的一个上:ipodtouch、iPhone、ipadmini、iPad、android,因为这些是我目前唯一拥有内容的设备。例如如果您在黑莓手机、Windows8甚至Firefox手机上观看,则不会显示此类别

有人能告诉我怎么做吗

多谢各位

我的索引页代码为:

<?PHP 
include_once('include/connection.php'); 
include_once('include/article.php');

$category = new category;
$articles = $category->fetch_all();


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Xclo.mobi</title>

<link type="text/css" rel="stylesheet" href="other.css" />
<link rel="apple-touch-icon" href="homescreen.png" />
<link href="startup.png" rel="apple-touch-startup-image" />


<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-34172259-1']);
_gaq.push(['_setDomainName', 'xclo.co.uk']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>

</head>
<body>

<?php include_once('header.php'); ?>


<div id="content">

<?php foreach ($articles as $article) { ?>

<ul class="pageitem"><li class="button"> 
<a href="list.php?id=<?php echo $article['promo_cat']; ?>">
<input type="submit" name="Submit" value="<?php echo $article['promo_cat']; ?>"/>
</a></li></ul>
<?php } ?>

</div>
<br><center>
<SCRIPT charset="utf-8" type="text/javascript" src="http://ws-eu.amazon-...d9-6cf16307e855"> </SCRIPT> <NOSCRIPT><A HREF="http://ws-eu.amazon-...t">Amazon.co.uk Widgets</A></NOSCRIPT></center>

<?php include_once('footer.php'); ?>


</body>
</html>

Xclo.mobi
var _gaq=_gaq | |[];
_gaq.push([''设置帐户','UA-3417225-1']);
_gaq.push([''u setDomainName',xclo.co.uk']);
_gaq.push([''u trackPageview']);
(功能(){
var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;
ga.src=('https:'==document.location.protocol?'https://ssl' : 'http://www“)+”.google analytics.com/ga.js';
var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);
})();

请帮忙。多谢各位

已排序

使用此代码:

<?php
$ua=$_SERVER['HTTP_USER_AGENT'];
switch(true) {
  case stripos($ua,'android') :
    $device = 'android'; break;
  case stripos($ua,'ipad') :
    $device = 'ipad'; break;
  case stripos($ua,'iphone') :
    $device = 'iphone'; break;
}
?> 
<ul class="pageitem"><li class="button android"><input name="Submit" value="App Downloads" onclick="window.location='apps.php?id=<?php echo $device; ?>' " type="submit" /></li></ul>