Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/244.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php UTF-8中导出sql_Php_Sql_Database_Utf 8_Export - Fatal编程技术网

在php UTF-8中导出sql

在php UTF-8中导出sql,php,sql,database,utf-8,export,Php,Sql,Database,Utf 8,Export,我想使用编码为UTF-8的php导出sql文件中数据库的所有表 最好的办法是什么!密码是什么! 谢谢您请在此之后开始查询: $db = new MySQLi("host", "username", "password", "db"); if(!$db) { die("your_error_msg" . mysqli_error($db)); } $db->set_charset("utf8");' 编辑 <?php //ENTER THE RELEVANT IN

我想使用编码为UTF-8的php导出sql文件中数据库的所有表 最好的办法是什么!密码是什么!
谢谢您

请在此之后开始查询:

$db = new MySQLi("host", "username", "password", "db");

if(!$db)
{
    die("your_error_msg" . mysqli_error($db));
}

$db->set_charset("utf8");'
编辑

<?php
    //ENTER THE RELEVANT INFO BELOW
    $mysqlDatabaseName ='xxxxxx';
    $mysqlUserName ='xxxxxxx';
    $mysqlPassword ='myPassword';
    $mysqlHostName ='xxxxxxxx.net';
    $mysqlExportPath ='chooseFilenameForBackup.sql';

    //DO NOT EDIT BELOW THIS LINE
    //Export the database and output the status to the page
    $command='mysqldump --opt -h' .$mysqlHostName .' -u' .$mysqlUserName .' -p' .$mysqlPassword .' --default-character-set=utf8 ' .$mysqlDatabaseName .' > ~/' .$mysqlExportPath;
    exec($command);
 ?>


From:,但是我添加了
--默认字符集=utf8
部分

我知道,我的问题是导出。。。将数据库导出为.sqlfileah的代码是什么。我读得很快,所以我误解了。呵呵。检查我的编辑