$res=mysql_query("select
創(chuàng)新互聯(lián)建站主要從事做網(wǎng)站、網(wǎng)站設(shè)計(jì)、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)武安,十余年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):028-86922220
*
from
keyword");//查找所有關(guān)鍵詞
while($row
=
mysql_fetch_array($rec)){//一次判斷,文章中有沒有出現(xiàn)該關(guān)鍵詞
$str
=
$row['name'];
$rec
=
mysql_query("select
*
from
文章表
where
$title
like
'%$str%'
or
$content
like
'%$str%'");//模糊查詢文章標(biāo)題和內(nèi)容中出現(xiàn)了的該關(guān)鍵詞的數(shù)據(jù)
$num
=
mysql_num_rows($rec);//文章標(biāo)題和內(nèi)容中出現(xiàn)了的該關(guān)鍵詞的文章條數(shù)
if($num){
echo
$str;
}
}
通常,從數(shù)據(jù)庫(kù)提取數(shù)據(jù)后,再生成:
?php
header('Content-Type:?text/html;?charset=UTF-8');
$con?=?mysql_connect('localhost',?'root',?'root');
mysql_select_db("php",?$con);
$sql?=?"SELECT?*?FROM?`keys`";
$result?=?mysql_query($sql);
while?($row?=?mysql_fetch_array($result))
{
$keys_val?=?$row['key_val'];
$keys_link?=?$row['key_link'];
echo?'a?target="_blank"?class="keyword"?href="'?.?$keys_link?.'"'?.$keys_val?.?'/a';
}
?
PHP關(guān)鍵字(68個(gè))
and or xor __FILE__ extends __LINE__ array() as break case class const continue declare default die() do echo else elseif empty() enddeclare endfor endforeach endif endswitch endwhile eval() exit() extends for foreach function global if include include_once isset() list() new print require require_once return static switch unset() use var while __FUNCTION__ __CLASS__ __METHOD__
final(PHP 5) php_user_filter(PHP 5) interface(PHP 5) implements(PHP 5) exception(PHP 5) public(PHP 5) private(PHP 5) protected(PHP 5) abstract(PHP 5) clone(PHP 5) try(PHP 5) catch(PHP 5) throw(PHP 5) cfunction(PHP 4 only) this(PHP 5 only)
final:在PHP中final關(guān)鍵字充當(dāng)鎖的作用,當(dāng)定義類的時(shí)候該類不能被繼承,當(dāng)用來定義方法的時(shí)候該方法不能被重載
self:用來訪問當(dāng)前類中內(nèi)容的關(guān)鍵字,類似于$this關(guān)鍵字,但$this需要類實(shí)例化后才能使用,$this不能夠訪問類中的靜態(tài)成員,self可以直接訪問當(dāng)前類中的內(nèi)部成員,包括靜態(tài)成員。$this關(guān)鍵字類實(shí)例化后可以使用,也可以在類的內(nèi)容訪問非靜態(tài)化成員
static:?jiǎn)为?dú)占據(jù)內(nèi)存,只初始化一次,訪問靜態(tài)成員要用::,類中的靜態(tài)成員和方法可以直接訪問,不需要實(shí)例化
const:用來定義類中的常量,類似PHP外部定義的常量的關(guān)鍵字define();CONSET只能修飾類當(dāng)中的成員屬性!常量建議都大寫,不使用$
關(guān)鍵字是不需要加$的。在類中訪問常量也是用self關(guān)鍵字~
本文標(biāo)題:php數(shù)據(jù)庫(kù)關(guān)鍵字 php關(guān)鍵詞搜索
網(wǎng)頁(yè)網(wǎng)址:http://sd-ha.com/article14/doosode.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、外貿(mào)建站、定制開發(fā)、移動(dòng)網(wǎng)站建設(shè)、小程序開發(fā)、建站公司
聲明:本網(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í)需注明來源: 創(chuàng)新互聯(lián)