
PHP
thomas_blog
路漫漫其修远兮
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
PHP文件下载
方式一<?php$file = 'monkey.gif';if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: ...转载 2018-08-14 13:40:16 · 163 阅读 · 0 评论 -
PHP生成json
索引数组<?php//json_encode(数组/对象)$color = array('red','blue','green');echo json_encode($color); //["red","blue","green"]?&amp转载 2018-08-13 10:15:41 · 2874 阅读 · 0 评论 -
PHP json中文
json_encode 和 json_decode 只支持utf-8编码的字符串,GBK的字符串要用json就得转换成utf-8字符串看效果<?phpheader("Content-type:text/html; charset=utf-8");$dirname = $_GET['dirname'];$dirname = iconv('utf-8', 'GBK'...转载 2018-08-26 09:15:24 · 750 阅读 · 0 评论 -
PHP数据库操作
查询数据<?php$username = 'furong';$con = mysql_connect("localhost", "root", "123456");if (!$con){ die('Could not connect: ' . mysql_error());}mysql_select_db("bank", $con);$result = my...转载 2018-08-23 15:31:38 · 178 阅读 · 0 评论 -
PHP中文乱码
中文乱码 就这一句就好使header(&quot;Content-type:text/html; charset=utf-8&quot;);$_GET 变量 包含中文的GET变量,如果在PHP中使用,必须要转换成GBK格式,否则无法使用&amp;lt;?phpheader(&quot;Content-type:text/html; charset=utf-8&quot;);$dirname = $_GET转载 2018-08-26 00:25:23 · 3023 阅读 · 1 评论