進(jìn)入php源程序目錄中的ext目錄中,這里存放著各個擴(kuò)展模塊的源代碼,選擇你需要的模塊,比如curl模塊:cd curl

10年積累的做網(wǎng)站、成都做網(wǎng)站經(jīng)驗(yàn),可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識你,你也不認(rèn)識我。但先網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有海港免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
執(zhí)行phpize生成編譯文件,phpize在PHP安裝目錄的bin目錄下
/usr/local/php5/bin/phpize
運(yùn)行時,可能會報錯:Cannot find autoconf. Please check your autoconf installation and
the $PHP_AUTOCONF
environment variable is set correctly and then rerun this
script.,需要安裝autoconf:
yum install autoconf(RedHat或者CentOS)、apt-get install
autoconf(Ubuntu Linux)
/usr/local/php5/bin/php -v
執(zhí)行這個命令時,php會去檢查配置文件是否正確,如果有配置錯誤,
這里會報錯,可以根據(jù)錯誤信息去排查!
獲取ppq數(shù)據(jù)庫的所有表名的代碼:
?php
$server='localhost';
$user='root';
$pass='12345';
$dbname='ppq';
$conn=mysql_connect($server,$user,$pass);
if(!$conn)
die("數(shù)據(jù)庫系統(tǒng)連接失敗!");
$result=mysql_list_tables($dbname);
if(!$result)
die("數(shù)據(jù)庫連接失敗!");
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ù)庫中的表
說明
resource
mysql_list_tables
(
string
database
[,
resource
link_identifier])
mysql_list_tables()
接受一個數(shù)據(jù)庫名并返回和
mysql_query()
函數(shù)很相似的一個結(jié)果指針。用
mysql_fetch_array()或者用mysql_fetch_row()來獲得一個數(shù)組,數(shù)組的第0列就是數(shù)組名,當(dāng)獲取不到時
mysql_fetch_array()或者用mysql_fetch_row()返回
FALSE。
代碼如下:?View
Code
PHP
include("conn.php");//調(diào)用數(shù)據(jù)庫連接文件
echo
"table
width=572
height=56
border=0
cellspacing=1
";
//創(chuàng)建html表格
echo
"tr
bgcolor=#9999FF";
echo
"th
width=33
scope=colid/th";
echo
"th
width=100
scope=coluser_name/th
";
echo
"th
width=100
scope=coluser_pass/th
";
echo
"th
width=100
scope=colstaus/th";
echo
"th
width=100
scope=colinsert_time/th";
echo
"/tr";
$SQL
=
"select
*
from
user_info";
$query
=
mysql_query($SQL);
//SQL查詢語句
while
($row
=
mysql_fetch_array($query)){
//使用while循環(huán)mysql_fetch_array()并將數(shù)據(jù)返回數(shù)組
echo
"tr
onmouseout=this.style.backgroundColor=''
onMouseOver=this.style.backgroundColor='#99CC33'
bgcolor=#CCCCCC";
echo
"td$row[0]/td";
//輸出數(shù)組中數(shù)據(jù)
echo
"td$row[1]/td";
echo
"td$row[2]/td";
echo
"td$row[3]/td";
echo
"td$row[4]/td";
echo
"/tr";
}
echo
"/table";輸出記錄截圖
我建議一下吧,文本數(shù)據(jù)庫的例子本來太多,但是為了邏輯簡化,最好通過專門接口實(shí)現(xiàn)文件與數(shù)據(jù)的轉(zhuǎn)換,可以采用我下面的模板編寫:
?php
//文件最前面定義兩個全局變量,數(shù)據(jù)庫文件名和用戶數(shù)組
$pwd_db_file='db.txt';
$UserPassword=array();
//下面的pwd_db_read函數(shù),把文件內(nèi)容讀入到全局?jǐn)?shù)組中
function pwd_db_read(){
global $pwd_db_file, $UserPassword;
$fp=fopen($pwd_db_file,'r');
while ($s=fgets($fp)){
list($usr,$pwd)=explode('|', $s);
$UserPassword[$usr]=$pwd;
}
fclose($fp);
}
//下面的pwd_db_write函數(shù)保存數(shù)組內(nèi)容到文件中
function pwd_db_write(){
global $pwd_db_file, $UserPassword;
fp=fopen($pwd_db_file, 'w');
foreach ($UserPassword as $usr=$pwd)
fputs($fp,"$usr|$pwd\n");
fclose($fp);
}
//有了上面的全局變量和函數(shù),要寫什么功能都簡單
//下面假釋本腳本調(diào)用的時候通過reg.php?job=adduser=...pass=...
//的格式進(jìn)行調(diào)用,job為add表示添加用戶,del表示刪除,modi表示修改
//另外的user和pass表示用戶名或者密碼,job不是以上內(nèi)容表示登錄
//主程序一開始就打開數(shù)據(jù)庫
pwd_db_read();
//下面判斷功能
if ($jon=='add'){
if (array_key_exists($user,$UserPassword)) echo "用戶 $user 已經(jīng)存在!"
else $UserPassword[$user]=$pass;//就一句話,簡單吧
}elseif (job=='del'){
unset($UserPassword[$user]);//你自己考慮編寫是否確認(rèn)刪除的內(nèi)容
}elseif ($job=='modi'){
if (array_key_exists($user,$UserPassword)) $UserPassword[$user]=$pass;//和添加是不是有點(diǎn)類似
else echo "用戶 $user 不存在!"
}else{
if ($UserPassword[$user]==$pass){
echo '密碼正確。';
//接下來可能要做許多事情
}else echo '密碼錯誤!';
}
//程序最后保存數(shù)據(jù)庫修改
pwd_db_write();
?
看得懂嗎,沒有上機(jī)調(diào)試,語法問題可能難免,如果發(fā)現(xiàn)不明白的問題請補(bǔ)充。
文章題目:php怎么獲得數(shù)據(jù)庫 php怎么獲得數(shù)據(jù)庫信息
文章分享:http://chinadenli.net/article8/ddgcsop.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作、品牌網(wǎng)站制作、微信小程序、電子商務(wù)、虛擬主機(jī)、自適應(yīng)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)