一段很简单的PHP代码,用于手机拨号
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>XXX联系方式</title> <meta name="viewport" content="width=device-width; initial-scale=1.0"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <style> .table th { text-align: center; font-size: 18px; vertical-align: middle !important; } .table td { font-size: 16px; vertical-align: middle !important; } h2 { font-weight:bold;text-align: center;} </style> </head> <body> <h2>XXX联系方式</h2> <table class="table table-bordered"> <thead> <tr> <th>序号</th> <th>姓名</th> <th>操作</th> </tr> </thead> <tbody> <?php $conn = mysqli_connect('127.0.0.1', 'root', 'root','table') or die ('连接失败: ' . mysqli_error()) ; // 设置编码,防止中文乱码 mysqli_query($conn , "set names utf8"); $sql = 'select * from TB_NLianXiFS order by id asc'; $retval = mysqli_query($conn, $sql ) or die("Error in query: $sql. ".mysql_error()); while($row = mysqli_fetch_assoc($retval)) { echo '<tr>'; echo '<td align="center">'.$row['id'].'</td>'; echo '<td>'.$row['name'].'</td>'; echo '<td><button type="button" class="btn btn-success" onclick="Calltel('.$row['tel'].');"> 拨号 </button> </td>'; echo "</tr>"; } mysqli_free_result($retval); $ip = getIp(); $rq = date("Y-m-d h:i:s"); $InsertSQL = "Insert into tb_njlb(ip,riqi) values ('$ip','$rq')" ; $result = mysqli_query($conn,$InsertSQL)or die("Error in Query ".mysql_error()); mysqli_close($conn); ?> </tbody> </table> <script type="text/javascript"> function Calltel(tel){ window.location.href = "tel:"+tel; } </script> </body> </html> <?php function getIp() { if ($_SERVER["HTTP_CLIENT_IP"] && strcasecmp($_SERVER["HTTP_CLIENT_IP"], "unknown")) { $ip = $_SERVER["HTTP_CLIENT_IP"]; } else { if ($_SERVER["HTTP_X_FORWARDED_FOR"] && strcasecmp($_SERVER["HTTP_X_FORWARDED_FOR"], "unknown")) { $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } else { if ($_SERVER["REMOTE_ADDR"] && strcasecmp($_SERVER["REMOTE_ADDR"], "unknown")) { $ip = $_SERVER["REMOTE_ADDR"]; } else { if (isset ($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown") ) { $ip = $_SERVER['REMOTE_ADDR']; } else { $ip = "unknown"; } } } } return ($ip); } ?>
EPX是利用基于Pascal的FastScript语言作为基础语言,在其中增加了许多函数与特性的一个扩展,将EPX组件本身融入到语言中去,使其能够更加灵活方便地运用EPX的所有功能,实现与EPX核心的友好交互。
欢迎加入【ePx Studio学习交流群】:113140060
https://jq.qq.com/?_wv=1027&k=5MYPTFX
欢迎加入【ePx Studio学习交流群】:113140060
https://jq.qq.com/?_wv=1027&k=5MYPTFX