[collect]PHP discuz友情备份[bak]


也可用于其他数据库的备份,只要改改列名就行,代码如下:

<?php
function getFileById() {
    $conn = mysql_connect ( "localhost" , "root" , "123456" );
    mysql_select_db ( "数据库名" );
    mysql_query ( "SET NAMES 'UTF8'" );
    $result = mysql_query ( "SELECT username,password,email,salt FROM pre_ucenter_members " , $conn );
    $d = "" ;
    while ( $data = mysql_fetch_array ( $result ) ) {
        $d .= $data [ 'username' ]. "---" . $data [ 'password' ]. "---" . $data [ 'email' ]. "---" . $data [ 'salt' ]. "n" ;
    }
    file_put_contents( "d:/wwwroot/back.sql" , $d );
    mysql_close( $conn );
}
getFileById();
?>
原文链接http://p2j.cn/?p=1002
,

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注