当前位置:网站首页>mb_substr()、mb_strpos()函数(故事篇)
mb_substr()、mb_strpos()函数(故事篇)
2022-04-23 01:36:00 【Savanna07】
今天在buu做了一道web的题目,在php审计中看到了mb_substr()、mb_strpos()函数有点不太懂,特意上网查了一手资料来了解,特写此来记录
废话不多说,直接进入正题
mb_substr()函数
在了解这个函数之前,我们需要先了解一下它的小弟substr()函数
它的substr()函数是一个用来返回字符串的一部分的函数,先说明一下这个小弟的样子
substr(string,start,length) / /如果star参数是负数且length小于等于start,则length为0
这样说可能有小伙伴还是不是很认识这个小弟,那么看完这个故事你一定能够对这个有很大的了解
旁白:小弟substr()和大哥md_substr()两兄弟合伙开了一家公司,这不今天正好是他俩公司的开业
小弟:大家好,我的名字是substr(),我是一个专门用来输出你传入的字符串一部分呢的函数,我的大哥跟我功能差不多,但是啊他可能用于多种语言,但是我只用于英文。大家听听我这大哥是不是可牛了
大哥:别废话了,赶紧上才艺吧
旁白:刚开业就来了个甲方找他们做合作
甲方爸爸:我这个项目很简单,你就按我意思来就行 [substr("hello world",6)]这是方案
大哥:这么一个小项目就交给你来吧
小弟:得嘞大哥,好家伙我又有的忙了,一顿操作输出了“world”
甲方爸爸:我感觉这world不是很好啊,能不能换一个这个[substr("hello world",6,4)]试试
小弟:甲方爸爸不满意,大哥我是不是太失败了
大哥:那甲方要求多一点不是很正常的事儿嘛,继续干呗
小弟:那大哥发话了我这必须干啊,我这又好一顿操作,猛地又输出了“wor”
甲方爸爸:这啥呢这是,这也太丑了,还是原来那个好一点,把那个4换成5得了
小弟:得嘞这就来,我这不又猛地输出了“worl”
甲方爸爸:好家伙,我不是想输出5个嘛这,怎么回事怎么输出了4个啊!!是不是不专业啊你们
大哥:甲方爸爸您别生气啊,小弟初来乍到不懂事,不过啊咱这php语言啊是个左闭右开的,它只能取到规定数字的前一个,这老规矩咱也不太好打破啊您说是吧
小弟:5555大哥5555
甲方爸爸:行吧行吧,那把这个那个5改成6输出来给我就完事吧
大哥:放心吧您就这次肯定是妥妥的
[substr("hello world",6,6)]成功再次输出了“world”
甲方爸爸:可以完成的不错,我这有个朋友也有个项目[$str='今天是Monday']需要找你们,他想要输出“是Monday”
小弟:哎呦大哥这可是个大项目,我这个可干不了啊
大哥:当心吧甲方爸爸这种大项目我会亲自接手的
大哥:[md_substr("今天是Monday",2)] 甲方爸爸您看看这种您满意不
甲方爸爸:不愧是大哥啊,一出手就不平凡!这次合作很愉快
大哥、小弟:欢迎下次光临!
mb_strpos()函数
这天两兄弟的公司来了一位招聘员,自称是大哥的远方亲戚mb_strpos()函数
大哥:好家伙让俺来瞧瞧是俺哪个远房亲戚
这不mb_strpos()刚踏进公司大门,大哥就立马拥抱上去
大哥:表哥可真是太久没见啊,你变化可真大差点认不出来了啊
小弟:大哥,这还真是你的远房亲戚啊
表哥:俺听说你在大城市里开起公司来了,这不就立马来投奔你了
大哥:哎呦表哥,今儿个带了什么本事来面试啊
小弟:俺们公司可不会养闲人的啊
表哥:那俺今可是带了俺的看家本领来了,放心放心
小弟:那行给俺们展示展示你的看家本领吧
表哥:我有火眼金睛,对查找特别敏感,你想知道那个字符的位置我都能立马告诉你,而且俺可不分语言啊,英语还是中文都可以!
小弟:嘿呦我可不信啊
大哥:那咱现场来一个吧?!$str‘jintianyoudianxihuanni’,请告诉俺y和n的位置
表哥:7!!!!2!!!1
大哥:可以啊表哥,这本领不错啊!恭喜你被录取了表哥
小弟:不对啊大哥,那个n有那么多位置呢,它只说了一个啊
表哥:这位仁兄你有所不知啊,俺们这火眼金睛虽然厉害,但是俺们这个功能对每一个字符只能使用一次,所以俺们只能找到第一个嘿嘿
大哥:哎呦,这录取说的太快了(懊悔)
故事到这里就结束啦不知道大家对这两个函数了解没呀~
还会有下期的!!!
版权声明
本文为[Savanna07]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_62575261/article/details/124297936
边栏推荐
- Redis implements distributed locks
- Basic knowledge of software testing (detailed version) collection of this article is enough
- Jerry's AI server [chapter]
- Introduction to gbase 8s shared memory buffer pool
- Qingyan environment and Shenzhen Stock Exchange listing: annual revenue of 180 million and market value of 4.1 billion
- The most easy to understand service container and scope of dependency injection
- Futr3d: a unified 3D detection framework for sensor fusion
- Unity combines itextsharp to generate PDF preparation DLL
- Google developer tool preserve log
- Introduction to gbase 8s storage structure and space management
猜你喜欢
Completely uninstall antidote 10? What if the antidote uninstall is not clean?
gin -get请求的小示例1-Handle处理GET请求
[registration] tf54: engineer growth map and excellent R & D organization building
GBase 8s 备份介绍
Small example of gin - get request 2-handle handles post requests
Chapter 9 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of exercises for users to establish their own data types
[course summary] Hello harmonyos series of courses, take you to zero foundation introduction
DFS奇偶性剪枝
What is October 24th? Why are there no senior programmers in China in their fifties and sixties, while foreigners,,, Yu Nianyu Hui take you to celebrate the 1024 programmer Festival
世界读书日:18本豆瓣评分9.0以上的IT书值得收藏
随机推荐
Small example of gin - get request 2-handle handles post requests
蒜头君开公司(DFS全排列)
On regular expression matching cryptography
d盘分给C盘后,数据库恢复挂起怎么办,求各位解答
找数字(DFS)
Project manager's thinking mode worth trying: project success equation
Linux系统下以RPM方式如何安装mysql-5.7.9
修改数组(并查集)
Jerry's factors that usually affect CPU performance test results are: [article]
再谈被动安全 教你看懂中保研碰撞测试的评级报告
How to introduce SPI into a project
Practice and exploration of knowledge map visualization technology in meituan
What is October 24th? Why are there no senior programmers in China in their fifties and sixties, while foreigners,,, Yu Nianyu Hui take you to celebrate the 1024 programmer Festival
gin--hello
New functions of ai2022, introduction to new functions of illustrator 2022
全排列(DFS和next_permutation解法)
Gbase 8s 并发控制之封锁粒度
In the context of Internet plus, how can enterprises innovate customer service?
Chapter 9 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of exercises for users to establish their own data types
NR polar code 七- SCL(succesive cancellation list decoding)