![](https://img-blog.csdnimg.cn/20200419210035780.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
★ PHP
https://blog.csdn.net/dyw_666666
烟敛寒林o
谋事在人,成事在天。
展开
-
PHP计算显示平均值、五个最低值及五个最高值
$num_temp = "78, 60, 62, 68, 71, 68, 73, 85, 66, 64, 76, 63, 81, 76, 73,68, 72, 73, 75, 65, 74, 63, 67, 65, 64, 68, 73, 75, 79, 73";$temp_array = explode(',', $num_temp); //分割获取数组中的数值$tot_temp = ...转载 2019-01-28 22:17:08 · 5013 阅读 · 0 评论 -
Code-Breaking Puzzles easy - phplimit(代码执行限制绕过)
题目地址:http://120.78.164.84:49006<?phpif(';' === preg_replace('/[^\W]+\((?R)?\)/', '', $_GET['code'])) { eval($_GET['code']);} else { show_source(__FILE__);}这里的正则匹配涉及到了PHP正则表达式的递归...原创 2019-05-09 21:05:39 · 977 阅读 · 0 评论 -
Code-Breaking Puzzles easy - function(匿名函数利用)
题目地址:http://120.78.164.84:49001/<?php$action = $_GET['action'] ?? '';$arg = $_GET['arg'] ?? '';if(preg_match('/^[a-z0-9_]*$/isD', $action)) { show_source(__FILE__);} else { $action(...原创 2019-05-09 21:13:06 · 876 阅读 · 1 评论 -
create_function() 代码注入,,PHP7.2竟然还存在
第一部分:php函数 create_function() 介绍理论:create_function()主要用来创建匿名函数,有时候匿名函数可以发挥它的作用。stringcreate_function (string$args ,string$code )string$args变量部分string$code 方法代码部分举例:create...转载 2019-05-09 17:18:33 · 10381 阅读 · 0 评论 -
parse_str函数变量覆盖缺陷
理论parse_str函数的作用就是解析字符串并注册成变量,在注册变量之前不会验证当前变量是否存在,所以直接覆盖掉已有变量。void parse_str ( string $str [, array &$arr ] )str 输入的字符串。arr 如果设置了第二个变量 arr,变量将会以数组元素的形式存入到这个数组,作为替代。实践测试代码:<?php...转载 2019-05-09 15:28:50 · 901 阅读 · 0 评论 -
过滤SQL注入和万能登录语句 の 各类函数及正则过滤总结
最近研究上了正则表达式,正则表达式是一种匹配字符串的工具,不过它非常强大,效率也很高。php虽然有庞大的函数库,但如果单靠php的系统函数写一个防SQL注入函数的函数就未免有点繁琐了。下面这个是我自己写的防SQL注入函数,可以去除特殊符号+*`/-$#^~!@#$%&[]'"、空格、换行符、制表符。应该可以过滤恶意sql查询语句和万能登录语句的输入。function c...转载 2019-03-10 21:53:51 · 1912 阅读 · 0 评论 -
PHP实现快速排序
function quick_sort($my_array){ $loe = $gt = array(); if(count($my_array) < 2) { return $my_array; } $pivot_key = key($my_array); $pivot = array_shift($my_array);...转载 2019-03-04 17:33:06 · 493 阅读 · 0 评论 -
PHP打印调用堆栈的三种方法
目录一、debug_print_backtrace()二、debug_backtrace()三、Exception类中的getTraceAsString()成员函数返回一个调用堆栈一、debug_print_backtrace()//调用函数parent_funcfunction child_func() { parent_func();}//调用grandp...转载 2019-01-28 23:05:34 · 11122 阅读 · 0 评论 -
PHP实现冒泡排序
$arr = [36, 26, 8, 21, 6, 23, 1, 3, 16];function bubbleSort($arr) { if (!is_array($arr)) { return false; } $count = count($arr); if ($count < 2) { return $arr;...转载 2019-01-28 22:50:33 · 7660 阅读 · 0 评论 -
PHP检查字符串中是否包含大写字符
function check_case($str) { for ($i = 0; $i < strlen($str); $i++) { if ( (ord($str[$i]) >= ord('A')) && (ord($str[$i]) <= ord('Z')) ) { return false; ...转载 2019-01-28 22:43:14 · 1286 阅读 · 0 评论 -
PHP代码优化技巧总结
echo 比 print 快。使用echo的多重参数代替字符串连接。在执行for循环之前确定最大循环数,不要每循环一次都计算最大值,最好运用foreach代替。对global变量,应该用完就unset()掉。用单引号代替双引号来包含字符串,这样做会更快一些。因为PHP会在双引号包围的字符串中搜寻变量,单引号则不会。函数代替正则表达式完成相同功能。当执行变量i的递增或递减时,i的递增或...转载 2018-08-11 13:44:38 · 162 阅读 · 0 评论 -
PHP面试100题汇总
1,Http 和Https的区别第一:http是超文本传输协议,信息是明文传输,https是具有安全性的ssl加密传输协议第二:http和https使用的是完全不同的连接方式,端口也不一样,前者80 或者443第三:http连接很简单,是无状态的。https协议是由ssl+http协议构建的可进行加密传输,身份认证的网络协议。 2.什么方法来加快页面的加载速度1,用到服务器...转载 2018-10-24 13:15:20 · 3587 阅读 · 0 评论 -
Code-Breaking Puzzles easy - pcrewaf(正则特性)
题目地址:http://120.78.164.84:49002/<?phpfunction is_php($data){ return preg_match('/<\?.*[(`;?>].*/is', $data);}if(empty($_FILES)) { die(show_source(__FILE__));}$user_dir = 'da...转载 2019-05-09 21:37:06 · 394 阅读 · 0 评论