頭部加上超時(shí)控制,但對(duì)于很多服務(wù)器無(wú)效,因?yàn)榉?wù)器輸出超時(shí)很多在服務(wù)器控制,所以建議用cmd腳本方式運(yùn)行此程序:

成都創(chuàng)新互聯(lián)公司專注于安平企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站,商城系統(tǒng)網(wǎng)站開(kāi)發(fā)。安平網(wǎng)站建設(shè)公司,為安平等地區(qū)提供建站服務(wù)。全流程定制開(kāi)發(fā),專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,成都創(chuàng)新互聯(lián)公司專業(yè)和態(tài)度為您提供的服務(wù)
?php
set_time_limit(0); //禁用腳本超時(shí)
//?Create?the?socket?and?connect
$socket?=?socket_create(AF_INET,?SOCK_STREAM,?SOL_TCP);
$connection?=?socket_connect($socket,'116。236。128。220',?14580);
//?Write?some?test?data?to?our?socket
if(!socket_write($socket,?"user?NoCall?pass?-1?vers?test?1.0?filter?b/B*?\r\n"))
{
echo("pWrite?failed/p");
}
if(!file_exists('socket_log.html')){
file_put_contents('socket_log.html',?'script
var?xx?=?setInterval(function(){ //每5秒刷新一次頁(yè)面
window.location.reload();
},?5000);
/script');
}
//?Read?any?response?from?the?socket
while($buffer?=?socket_read($socket,?64,?PHP_NORMAL_READ))
{
echo?json_encode($buffer);?//轉(zhuǎn)換為json數(shù)據(jù)輸出
//記入文件
file_put_contents('socket_log.html',?json_encode($buffer),?FILE_APPEND);
}
echo("pDone?Reading?from?Socket/p");
使用方法:用命令行方式運(yùn)行此腳本
php?script.php
腳本會(huì)一直運(yùn)行到接收數(shù)據(jù)結(jié)束,并持續(xù)將收到的數(shù)據(jù)寫入socket_log.html文件。
在瀏覽器打開(kāi)socket_log.html頁(yè)面,此頁(yè)面會(huì)自動(dòng)每5秒刷新一次,來(lái)顯示最新的數(shù)據(jù)。
確保程序有權(quán)限創(chuàng)建及寫入socket_log.html文件
獲取ppq數(shù)據(jù)庫(kù)的所有表名的代碼:
?php
$server='localhost';
$user='root';
$pass='12345';
$dbname='ppq';
$conn=mysql_connect($server,$user,$pass);
if(!$conn)
die("數(shù)據(jù)庫(kù)系統(tǒng)連接失敗!");
$result=mysql_list_tables($dbname);
if(!$result)
die("數(shù)據(jù)庫(kù)連接失敗!");
while($row=mysql_fetch_row($result))
{
echo
$row[0]."
";
}
mysql_free_result($result);
?
mysql_list_tables
(PHP
3,
PHP
4
,
PHP
5)
mysql_list_tables
--
列出
MySQL
數(shù)據(jù)庫(kù)中的表
說(shuō)明
resource
mysql_list_tables
(
string
database
[,
resource
link_identifier])
mysql_list_tables()
接受一個(gè)數(shù)據(jù)庫(kù)名并返回和
mysql_query()
函數(shù)很相似的一個(gè)結(jié)果指針。用
mysql_fetch_array()或者用mysql_fetch_row()來(lái)獲得一個(gè)數(shù)組,數(shù)組的第0列就是數(shù)組名,當(dāng)獲取不到時(shí)
mysql_fetch_array()或者用mysql_fetch_row()返回
FALSE。
三中接受方式:
$_GET ? ?//get過(guò)來(lái)的數(shù)據(jù)
$_POST ?//post過(guò)來(lái)的數(shù)據(jù)
file_get_contents("php://input") ? //接口過(guò)來(lái)的xml等字符串?dāng)?shù)據(jù)用這個(gè)接
這三個(gè)方法足以接受任何數(shù)據(jù)了,具體你還要百度一下用法
網(wǎng)站標(biāo)題:php接受數(shù)據(jù)顯示 php接收post數(shù)據(jù)json
文章起源:http://chinadenli.net/article34/dojodse.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、網(wǎng)站維護(hù)、網(wǎng)站排名、網(wǎng)站導(dǎo)航、營(yíng)銷型網(wǎng)站建設(shè)、外貿(mào)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)