php
丶何苦丶
没有做不到的,只有不想做的.
展开
-
php解析url几种方式
php解析url几种方式 利用$_SERVER内置数组变量 访问: http://localhost/test.php?m=admin&c=index&a=lists&catid=1&page=1 //URL的参数 echo $_SERVER['QUERY_STRING']; 返回: m=admin&c=index&a=lists&catid=1&page=1 //包含文件名 echo $_SERVER["REQUEST_URI"];原创 2020-08-19 10:52:19 · 474 阅读 · 0 评论 -
php (zip)文件下载设置
普通下载头大概意思,文件输出的地方二选一,小文件下载。如文件较大时注意执行时间与内存使用。可以看php大文件下载 $filename = $_GET['filename']; $pathname = "./sucai/$filename"; $filesize = filesize($pathname); //跟据路径下载文件 //字节流的方式发送到客户端 header("content-type:application/octet-stream"); //header("content-type:a原创 2020-08-19 10:50:34 · 401 阅读 · 0 评论 -
php 获取当前完整url地址
echo $url = $_SERVER["REQUEST_SCHEME"].'://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];原创 2020-08-19 10:49:56 · 160 阅读 · 0 评论 -
php 实现重定向的三种方式
header()函数; header('location:http://www.baidu.com'); meta标签; echo '<meta http-equiv="refresh" content="1;url=http://www.baidu.com">'; script标签; echo '<script>window.location.href="http://www.baidu.com"</script>';原创 2020-08-19 10:49:05 · 154 阅读 · 0 评论 -
php 查看使用多少内存
方法memory_get_usage 是指当前脚本正在使用的内存 unset只是把内存标记为空闲但并没有释放,要GC程序结束后才会释放 $bytes = memory_get_peak_usage(); function formatBytes($bytes, $precision = 2) { $units = array("b", "kb", "mb", "gb", "tb"); $bytes = max($bytes, 0); $pow = floor(($bytes ?原创 2020-08-19 10:48:22 · 271 阅读 · 0 评论