取得phpcms网站下所有栏目的内容链接_PHP教程

WBOY
Lepaskan: 2016-07-15 13:21:49
asal
1221 orang telah melayarinya

<?php  
    $conf[&#39;DB_USER&#39;] = &#39;user&#39;;  
    $conf[&#39;DB_PWD&#39;] = &#39;pwd&#39;;  
    $conf[&#39;DB_NAME&#39;] = &#39;dbname&#39;;  
    $conn = mysql_connect(&#39;localhost&#39;,$conf[&#39;DB_USER&#39;],$conf[&#39;DB_PWD&#39;]);  
    if (!$conn) {  
        echo &#39;数据库连接错误!&#39;;  
    }  
    mysql_set_charset(&#39;utf8&#39;, $conn);        //set charset  
    mysql_select_db($conf[&#39;DB_NAME&#39;]);       //select datebase     
    $sql2 = &#39;select catid,catname from v9_category&#39;;  
    $cat = mysql_query($sql2);  
    while ($catrow=mysql_fetch_array($cat)) {  
        echo $catrow[&#39;catname&#39;].&#39;</br>&#39;;  
        $sql = &#39;(select title,url from v9_news where catid=&#39;.$catrow["catid"].&#39; order by id desc)   
         UNION (select title,url from v9_product where catid=&#39;.$catrow["catid"].&#39; order by id desc)&#39;;  
        $result = mysql_query($sql);  
        while ($row=mysql_fetch_array($result)) {     
            echo $row[&#39;url&#39;]."</br>";           
        }  
    }  
?>  
Salin selepas log masuk

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477135.htmlTechArticle?php $conf[DB_USER] = user; $conf[DB_PWD] = pwd; $conf[DB_NAME] = dbname; $conn = mysql_connect(localhost,$conf[DB_USER],$conf[DB_PWD]); if (!$conn) { echo 数据库连接错误!...
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan