vb 6.0 中 ,保存 text 内容 到C盘 ,为 utf-8编码 php文件

PHP\u6587\u4ef6\u63d2\u5165header("Content-type: text/html; charset=utf-8"); \u62a5\u9519

header("Conten-type:text/html;charset=utf-8");
\u5199\u9519\u4e86 \u5c11\u4e2a t\u5e94\u8be5\u662f
header("Content-type:text/html;charset=utf-8");
\u6216\u8005\u8fd9\u6837\uff1a
<?php
header("Content-type:text/html;charset=gb2312");$dir="d:/";
$fp=opendir($dir);
while(($file=readdir($fp))!==false){
echo $file."";
}
closedir($fp);
?>

\u6269\u5c55\u8d44\u6599\uff1aPHP\u4e2dheader('content-type:text/html;charset="utf-8')\u548cerror_reporting()\u7684\u4f5c\u7528
1.header
PHP\u6587\u4ef6\u63d2\u5165header("Content-type: text/html; charset=utf-8");\u76f8\u5f53\u4e8e\u9875\u9762\u91cc\u9762\u7684;\u76ee\u7684\uff1a\u9632\u6b62\u9875\u9762\u51fa\u73b0\u4e71\u7801
2.error_reporting
\u5b9a\u4e49\u548c\u7528\u6cd5\uff1aerror_reporting()\u8bbe\u7f6ePHP\u7684\u62a5\u9519\u7ea7\u522b\u5e76\u8fd4\u56de\u5f53\u524d\u7ea7\u522b\u3002\u51fd\u6570\u8bed\u6cd5\uff1aerror_reporting(report_level)
\u5982\u679c\u53c2\u6570 level \u672a\u6307\u5b9a\uff0c\u5f53\u524d\u62a5\u9519\u7ea7\u522b\u5c06\u88ab\u8fd4\u56de\u3002\u4e0b\u9762\u51e0\u9879\u662flevel\u53ef\u80fd\u7684\u503c\uff1a
1\uff1aE_ERROR \u81f4\u547d\u7684\u8fd0\u884c\u9519\u8bef\u3002\u9519\u8bef\u65e0\u6cd5\u6062\u590d\uff0c\u6682\u505c\u6267\u884c\u811a\u672c\u3002
2\uff1aE_WARNING \u8fd0\u884c\u65f6\u8b66\u544a(\u975e\u81f4\u547d\u6027\u9519\u8bef)\u3002\u975e\u81f4\u547d\u7684\u8fd0\u884c\u9519\u8bef\uff0c\u811a\u672c\u6267\u884c\u4e0d\u4f1a\u505c\u6b62\u3002
4\uff1aE_PARSE \u7f16\u8bd1\u65f6\u89e3\u6790\u9519\u8bef\u3002\u89e3\u6790\u9519\u8bef\u53ea\u7531\u5206\u6790\u5668\u4ea7\u751f\u3002
8\uff1aE_NOTICE \u8fd0\u884c\u65f6\u63d0\u9192(\u8fd9\u4e9b\u7ecf\u5e38\u662f\u4f60\u4ee3\u7801\u4e2d\u7684bug\u5f15\u8d77\u7684\uff0c\u4e5f\u53ef\u80fd\u662f\u6709\u610f\u7684\u884c\u4e3a\u9020\u6210\u7684\u3002)
16\uff1aE_CORE_ERROR PHP\u542f\u52a8\u65f6\u521d\u59cb\u5316\u8fc7\u7a0b\u4e2d\u7684\u81f4\u547d\u9519\u8bef\u3002
32\uff1aE_CORE_WARNING PHP\u542f\u52a8\u65f6\u521d\u59cb\u5316\u8fc7\u7a0b\u4e2d\u7684\u8b66\u544a(\u975e\u81f4\u547d\u6027\u9519)\u3002
64\uff1aE_COMPILE_ERROR \u7f16\u8bd1\u65f6\u81f4\u547d\u6027\u9519\u3002\u8fd9\u5c31\u50cf\u7531Zend\u811a\u672c\u5f15\u64ce\u751f\u6210\u4e86\u4e00\u4e2aE_ERROR\u3002
128\uff1aE_COMPILE_WARNING \u7f16\u8bd1\u65f6\u8b66\u544a(\u975e\u81f4\u547d\u6027\u9519)\u3002\u8fd9\u5c31\u50cf\u7531Zend\u811a\u672c\u5f15\u64ce\u751f\u6210\u4e86\u4e00\u4e2aE_WARNING\u8b66\u544a\u3002
256\uff1aE_USER_ERROR \u7528\u6237\u81ea\u5b9a\u4e49\u7684\u9519\u8bef\u6d88\u606f\u3002\u8fd9\u5c31\u50cf\u7531\u4f7f\u7528PHP\u51fd\u6570trigger_error\uff08\u7a0b\u5e8f\u5458\u8bbe\u7f6eE_ERROR\uff09
512\uff1aE_USER_WARNING \u7528\u6237\u81ea\u5b9a\u4e49\u7684\u8b66\u544a\u6d88\u606f\u3002\u8fd9\u5c31\u50cf\u7531\u4f7f\u7528PHP\u51fd\u6570trigger_error\uff08\u7a0b\u5e8f\u5458\u8bbe\u5b9a\u7684\u4e00\u4e2aE_WARNING\u8b66\u544a\uff09
1024\uff1aE_USER_NOTICE \u7528\u6237\u81ea\u5b9a\u4e49\u7684\u63d0\u9192\u6d88\u606f\u3002\u8fd9\u5c31\u50cf\u4e00\u4e2a\u7531\u4f7f\u7528PHP\u51fd\u6570trigger_error\uff08\u7a0b\u5e8f\u5458\u4e00\u4e2aE_NOTICE\u96c6\uff09
2048\uff1aE_STRICT \u7f16\u7801\u6807\u51c6\u5316\u8b66\u544a\u3002\u5141\u8bb8PHP\u5efa\u8bae\u5982\u4f55\u4fee\u6539\u4ee3\u7801\u4ee5\u786e\u4fdd\u6700\u4f73\u7684\u4e92\u64cd\u4f5c\u6027\u5411\u524d\u517c\u5bb9\u6027\u3002
4096\uff1aE_RECOVERABLE_ERROR \u5f00\u6355\u81f4\u547d\u9519\u8bef\u3002\u8fd9\u5c31\u50cf\u4e00\u4e2aE_ERROR\uff0c\u4f46\u53ef\u4ee5\u901a\u8fc7\u7528\u6237\u5b9a\u4e49\u7684\u5904\u7406\u6355\u83b7\uff08\u53c8\u89c1set_error_handler\uff08\uff09\uff09
8191\uff1aE_ALL \u6240\u6709\u7684\u9519\u8bef\u548c\u8b66\u544a(\u4e0d\u5305\u62ec E_STRICT) (E_STRICT will be part of E_ALL as of PHP 6.0)\u4efb\u610f\u6570\u76ee\u7684\u4ee5\u4e0a\u9009\u9879\u90fd\u53ef\u4ee5\u7528\u201c\u6216\u201d\u6765\u8fde\u63a5(\u7528 OR \u6216 |)\uff0c\u8fd9\u6837\u53ef\u4ee5\u62a5\u544a\u6240\u6709\u9700\u8981\u7684\u5404\u7ea7\u522b\u9519\u8bef\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u7684\u4ee3\u7801\u5173\u95ed\u4e86\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u9519\u8bef\u548c\u8b66\u544a\uff0c\u6267\u884c\u4e86\u67d0\u4e9b\u64cd\u4f5c\uff0c\u7136\u540e\u6062\u590d\u5230\u539f\u59cb\u7684\u62a5\u9519\u7ea7\u522b

\u9996\u5148\uff0cUTF-8\u7f16\u7801\u7684\u4e2d\u6587\u5b57\u7b26\u4e5f\u662f\u6b63\u5e38\u7684\u3002
\u5982\u679c\u4f60\u8ba4\u4e3a gb2312 \u624d\u201c\u6b63\u5e38\u201d, \u53ef\u4ee5\u8fd9\u6837\uff1a
$utf8_str = '\u4e2d\u6587'; // \u6ce8\u610f\u8fd9\u513f\u5f97\u662f UTF-8 \u7f16\u7801\u7684\u5b57\u7b26\u4e32
$gb2312_str = mb_convert_encoding($str, 'GB2312', 'UTF-8');

%E5%90%89%E6%9E%97
\u6709\u4eba\u5df2\u7ecf\u56de\u7b54\u4e86\uff0c
\u7528 urldecode \u5c31\u884c\u4e86\u3002

假设想保存的文本都在Text1文本框里面,以下代码需引用 MicroSoft ActiveX Data Objects 2.5 Library:
Private Sub Command1_Click()
Dim adostream As New ADODB.Stream
With adostream
.Type = adTypeText
.Mode = adModeReadWrite
.Charset = "utf-8"
.Open
.Position = 0
.WriteText Text1.Text '想保存的文本都在Text1文本框里面
.SaveToFile "D:\test.txt", adSaveCreateOverWrite '保存到D:\test.txt
.Close
End With
Set adostream = Nothing
End Sub

With CreateObject("ADODB.Stream")
.Open
.Charset = "utf-8"
.WriteText Text1.Text
.SaveToFile "C:\a.txt", 2 '保存到文件,2表示覆盖现有文件
.Close
End With

扩展阅读:cad快速看图 ... 怎么卸载vb6.0 ... vb6.0中format函数用法 ... g β大师 ... vb6.0和vb net区别 ... vb6.0怎么安装 ... giant ... vb6.0官方下载 ... vb6.0教程 ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网