各类知识收集,PHP技术分享与解决方案各类知识收集,PHP技术分享与解决方案各类知识收集,PHP技术分享与解决方案

Str Tom,为分享PHP技术和解决方案,贡献一份自己的力量!
收藏本站(不迷路),每天更新好文章!
当前位置:首页 > CMS教程 > PHP

字符串php读取html并截取字符串的简单代码

管理员 2023-09-05
PHP
148

字符串php读取html并截取字符串的简单代码

内容导读

收集整理的这篇技术教程文章主要介绍了字符串php读取html并截取字符串的简单代码,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含991字,纯文字阅读大概需要2分钟

内容图文

代码如下:


$title='本站';
$hello='jb51.net!';
$file=file_get_contents('http://www.baidu.com');
$file=iconv("gbk//IGNORE","utf-8",$file);
//echo $file;
echo strpos($file,''); <BR>echo substr($file,strpos($file,'<title>')+7,strpos($file,''-strpos($file,'')+7)); <BR>$file=str_replace(array('百度一下','{hello}'),array($title,$hello), $file); <BR>?> <BR /></p><BR />下面是渝海用的小偷程序代码。大家可以多看下。本站提供多款小偷程序。<BR /><p><span><U></U></span> 代码如下:</p><p><BR /><?php <BR>function _url($Date){ <BR> $ch = curl_init(); <BR> $timeout = 5; <BR> curl_setopt ($ch, CURLOPT_URL, "$Date"); <BR> curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); <BR> curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); <BR> curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); <BR> $contents = curl_exec($ch); <BR> curl_close($ch); <BR> return $contents; <BR>} <BR>$url="http://www.gxlcms.com"; <BR>$contents.=_url($url); <BR>echo $contents; //</pre>输出内容 <BR>?><BR /></p> <p> 以上就介绍了字符串 php读取html并截取字符串的简单代码,包括了字符串方面的内容,希望对PHP教程有兴趣的朋友有所帮助。 </p> <h4 class="article-section-summary">内容总结</h4> <blockquote> <p> 以上是为您收集整理的<strong>字符串php读取html并截取字符串的简单代码</strong>全部内容,希望文章能够帮你解决<strong>字符串php读取html并截取字符串的简单代码</strong>所遇到的程序开发问题。 如果觉得技术教程内容还不错,欢迎将网站推荐给程序员好友。 </p> </blockquote> <h4 class="article-section-remark">内容备注</h4> <blockquote> <p> <strong>版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。</strong> </p> </blockquote> <div class="tb-copyright -rds art">未经允许不得转载:<a href="/">Str Tom工作室</a> » <a href="https://www.niuyn.cn/php/55525.html">字符串php读取html并截取字符串的简单代码</a> </div> </div> <div class="art-footer p"> <div class="art-author"> <img alt='' src='/static/picture/724c6f639a3e4172990cbd190d928c49.gif' srcset='https://cravatar.cn/avatar/e6c31d18052706ff3f5fe7e496031e47?s=80&d=mystery 2x' class='avatar avatar-40 photo' height='40' width='40' loading='lazy' decoding='async' /> <div class="-detail"><span class="-name">管理员</span> <p class="-desc">如果您对网站的内容有任何想法或意见,请call我!~~</p> </div> </div> <div class="art-tool"><span class="-meta tb-like" data-id="1457" data-event="like_add"><i class="tbfa"></i><i class="tbfa"></i><span class="count">16</span><i class="status">已赞</i> </span> <div class="social-share" data-event="show_share"><span class="-meta tbfa fa-share"> 分享</span> </div> </div> </div> </div> <div class="post-nav tb-b-card m-no-rds"> <div class="-item prev"><a href="https://www.niuyn.cn/php/55524.html">sumproduct函数的使用方法php实现网站插件机制的方法</a> </div> <div class="-item next"><a href="https://www.niuyn.cn/php/55526.html">serverapplicationerrorphp$_SERVER当前完整url的写法</a> </div> </div> <div class="tb-relevant"> <div class="tb-card-title "> <h3>相关推荐</h3> <div class="-title-tabs"></div> </div> <ul class="post-list -rds tb-row"> <li class="post-news -rds"> <a class="info-wraper" href="https://www.niuyn.cn/php/56331.html"> <div class="p-t-w">PHP如何获取一周的第一天</div> <p class="tb-excerpt">PHP如何获取一周的第一天 内容导读 ......</p> </a> </li> <li class="post-news -rds"> <a class="info-wraper" href="https://www.niuyn.cn/php/57144.html"> <div class="p-t-w">phpmt_rand函数怎么用</div> <p class="tb-excerpt">phpmt_rand函数怎么用 内容导读 ......</p> </a> </li> <li class="post-news -rds"> <a class="info-wraper" href="https://www.niuyn.cn/php/57174.html"> <div class="p-t-w">如何下载php开源代码</div> <p class="tb-excerpt">如何下载php开源代码 内容导读 ......</p> </a> </li> <li class="post-news -rds"> <a class="info-wraper" href="https://www.niuyn.cn/php/53521.html"> <div class="p-t-w">如何增加php内存?</div> <p class="tb-excerpt">如何增加php内存? 内容导读 ......</p> </a> </li> <li class="post-news -rds"> <a class="info-wraper" href="https://www.niuyn.cn/php/58388.html"> <div class="p-t-w">关于PHP中debug_backtrace()函数打印调用处的调试信息</div> <p class="tb-excerpt">关于PHP中debug_backtrace()函数打印调用处的调试信息 内容导读 ......</p> </a> </li> <li class="post-news -rds"> <a class="info-wraper" href="https://www.niuyn.cn/php/58940.html"> <div class="p-t-w">php生命周期的详解(图)</div> <p class="tb-excerpt">php生命周期的详解(图) 内容导读 ......</p> </a> </li> <li class="post-news -rds"> <a class="info-wraper" href="https://www.niuyn.cn/dedecms/69378.html"> <div class="p-t-w">解决DEDECMS采集文章待审核后仍列表显示</div> <p class="tb-excerpt">进行处理之前,首先备份数据库! 一、把文章批量转为“未审核”状态 到系统设置里面,运行SQL命令,输入: update dede_archives set arcrank=-1 如果数据库安装时候de......</p> </a> </li> <li class="post-news -rds"> <a class="info-wraper" href="https://www.niuyn.cn/dedecms/64869.html"> <div class="p-t-w">DEDECMS全站关键字自动添加链接的方法</div> <p class="tb-excerpt">DEDECMS的全内链方案,所有设置关键词的内链都会在文档中创建,突破keyword的限制。 注:网站关键字过多,使用这个修改后,生成HTML的时候会比较慢。大家多测试看看! 1.修......</p> </a> </li> </ul> </div> </div> <div class="tb-sidebar" data-roll="1 2"> <div class="widget tb-widget-asosod -rds"> <a target="_blank" href="/"> <img src="/static/picture/ui-01.png"> </a> </div> <div class="widget tb-widget-posts"> <div class="tb-card-title "> <h3>文章</h3> <div class="-title-tabs"></div><a class="-more" href="https://www.niuyn.cn/CMS/">更多<i class="tbfa"></i></a> </div> <ul class="tb-side-post -rds"> <li class="-rds tb-side-news"> <a class="info-wraper" href="https://www.niuyn.cn/php/59072.html"> <div class="tb-thumb -rds"><img class="-rds" alt="dedecms nginx环境下手机端伪静态设置教程" data-src="/static/picture/5fd0b37cd7dbbb0-e1690186027403-320x200.jpg" style=""></div> <div class="p-t-w">dedecms nginx环境下手机端伪静态设置教程</div> <div class="-metas"><span class="-meta -date"> 10-06</span><span class="-meta -views tbfa fa-views"> 856</span> </div> </a> </li> <li class="-rds tb-side-news"> <a class="info-wraper" href="https://www.niuyn.cn/php/56474.html"> <div class="tb-thumb -rds"><img class="-rds" alt="PHP如何删除当前目录及其目录下的所有文件?(代码示例)" data-src="/static/picture/5fd0b37cd7dbbb0-e1690186027403-320x200.jpg" style=""></div> <div class="p-t-w">PHP如何删除当前目录及其目录下的所有文件?(代码示例)</div> <div class="-metas"><span class="-meta -date"> 09-05</span><span class="-meta -views tbfa fa-views"> 783</span> </div> </a> </li> <li class="-rds tb-side-news"> <a class="info-wraper" href="https://www.niuyn.cn/php/57863.html"> <div class="tb-thumb -rds"><img class="-rds" alt="PHP实现的防止跨站和xss攻击代码php技巧" data-src="/static/picture/5fd0b37cd7dbbb0-e1690186027403-320x200.jpg" style=""></div> <div class="p-t-w">PHP实现的防止跨站和xss攻击代码php技巧</div> <div class="-metas"><span class="-meta -date"> 09-05</span><span class="-meta -views tbfa fa-views"> 770</span> </div> </a> </li> <li class="-rds tb-side-news"> <a class="info-wraper" href="https://www.niuyn.cn/php/55318.html"> <div class="tb-thumb -rds"><img class="-rds" alt="symantecpcanywherephpSQL之where语句生成器" data-src="/static/picture/5fd0b37cd7dbbb0-e1690186027403-320x200.jpg" style=""></div> <div class="p-t-w">symantecpcanywherephpSQL之where语句生成器</div> <div class="-metas"><span class="-meta -date"> 09-05</span><span class="-meta -views tbfa fa-views"> 769</span> </div> </a> </li> <li class="-rds tb-side-news"> <a class="info-wraper" href="https://www.niuyn.cn/php/55099.html"> <div class="tb-thumb -rds"><img class="-rds" alt="motodefyme525PHP中MD5函数使用实例代码" data-src="/static/picture/5fd0b37cd7dbbb0-e1690186027403-320x200.jpg" style=""></div> <div class="p-t-w">motodefyme525PHP中MD5函数使用实例代码</div> <div class="-metas"><span class="-meta -date"> 09-05</span><span class="-meta -views tbfa fa-views"> 757</span> </div> </a> </li> <li class="-rds tb-side-news"> <a class="info-wraper" href="https://www.niuyn.cn/php/54815.html"> <div class="tb-thumb -rds"><img class="-rds" alt="数据操作phpfans留言版用到的数据操作类和分页类" data-src="/static/picture/5fd0b37cd7dbbb0-e1690186027403-320x200.jpg" style=""></div> <div class="p-t-w">数据操作phpfans留言版用到的数据操作类和分页类</div> <div class="-metas"><span class="-meta -date"> 09-05</span><span class="-meta -views tbfa fa-views"> 751</span> </div> </a> </li> <li class="-rds tb-side-news"> <a class="info-wraper" href="https://www.niuyn.cn/php/58650.html"> <div class="tb-thumb -rds"><img class="-rds" alt="PHP通过realpath将相对路径转换为绝对路径的代码实例" data-src="/static/picture/5fd0b37cd7dbbb0-e1690186027403-320x200.jpg" style=""></div> <div class="p-t-w">PHP通过realpath将相对路径转换为绝对路径的代码实例</div> <div class="-metas"><span class="-meta -date"> 09-05</span><span class="-meta -views tbfa fa-views"> 743</span> </div> </a> </li> <li class="-rds tb-side-news"> <a class="info-wraper" href="https://www.niuyn.cn/php/53588.html"> <div class="tb-thumb -rds"><img class="-rds" alt="win10怎么启动phpnow服务器" data-src="/static/picture/5fd0b37cd7dbbb0-e1690186027403-320x200.jpg" style=""></div> <div class="p-t-w">win10怎么启动phpnow服务器</div> <div class="-metas"><span class="-meta -date"> 09-05</span><span class="-meta -views tbfa fa-views"> 739</span> </div> </a> </li> <li class="-rds tb-side-news"> <a class="info-wraper" href="https://www.niuyn.cn/php/54559.html"> <div class="tb-thumb -rds"><img class="-rds" alt="php验证姓名是否存在于mysql" data-src="/static/picture/5fd0b37cd7dbbb0-e1690186027403-320x200.jpg" style=""></div> <div class="p-t-w">php验证姓名是否存在于mysql</div> <div class="-metas"><span class="-meta -date"> 09-05</span><span class="-meta -views tbfa fa-views"> 661</span> </div> </a> </li> <li class="-rds tb-side-news"> <a class="info-wraper" href="https://www.niuyn.cn/php/58960.html"> <div class="tb-thumb -rds"><img class="-rds" alt="PHPMySQL:将数据插入表中" data-src="/static/picture/5fd0b37cd7dbbb0-e1690186027403-320x200.jpg" style=""></div> <div class="p-t-w">PHPMySQL:将数据插入表中</div> <div class="-metas"><span class="-meta -date"> 09-05</span><span class="-meta -views tbfa fa-views"> 633</span> </div> </a> </li> </ul> </div> </div> </div> <div class="tb-rtools"> <div class="-item -contact -rds tb-hover-trigger" data-event="toggle_f_contact"><p class="-info"><span class="tbfa fa-wechat"></span></p><div class="tb-tooltip -l-c -pop"><div class="-inner -rds"><p class="-desc">扫码关注</p><img alt="qrcode" class="-qrcode" src="/uploads/202306/09/230609110735957.png"></div></div></div><div class="-item -contact -rds tb-hover-trigger" data-event="toggle_f_contact"><a target="_blank" class="-info" href="http://wpa.qq.com/msgrd?v=3&uin=420220301&site=qq&menu=yes"><span class="tbfa fa-custom-contact"></span></a><div class="tb-tooltip -l-c -pop"><div class="-inner -rds"><p class="-desc">QQ交谈</p></div></div></div><div class="-item -rds scroll-top tb-hover-trigger" data-event="scroll_top"><span class="-info tbfa fa-go-top"></span><div class="tb-tooltip -l-c -pop"><div class="-inner -rds"><p class="-desc">回顶部</p></div></div></div></div> <footer class="tb-main-wraper"><div class="tb-footer"><div class="tb-f-links"><strong>友情链接</strong> <ul class='xoxo blogroll'> <li class="menu-item menu-item-706"><a href="https://pagespeed.web.dev/analysis/https-www-niuyn-cn/xvx6l1ywlw?form_factor=mobile">查seo</a></li> <li class="menu-item menu-item-706"><a href="http://vjs.zencdn.net/v/oceans.mp4">测试视频</a></li> <li class="menu-item menu-item-706"><a href="https://www.kancloud.cn/manual/thinkphp5/125016">THINKPHP5手册</a></li> <li class="menu-item menu-item-706"><a href="https://winginx.com/en/htaccess">伪静态规则转换</a></li> <li class="menu-item menu-item-706"><a href="https://www.iconfont.cn/">阿里云矢量库</a></li> <li class="menu-item menu-item-706"><a href="http://jq22.com">JS特效</a></li> <li class="menu-item menu-item-706"><a href="https://coding.tools/cn/html-beautifier">html格式化工具2</a></li> <li class="menu-item menu-item-706"><a href="https://font.qqe2.com/index.html">字体查看</a></li> <li class="menu-item menu-item-706"><a href="https://www.wetools.com/html-formatter">HTML格式化工具</a></li> <li class="menu-item menu-item-706"><a href="https://www.motobit.com/util/base64-decoder-encoder.asp">base64字体解码</a></li> <li class="menu-item menu-item-706"><a href="https://www.pweb123.com/">石头博客</a></li> </ul> </div><div class="-text">该块显示在网站底部版权上方,可以定义链接或图片之类的内容</div> <div class="-by"> <p>Powered By 各类知识收集 © 2014-2023 备案号:<a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">冀ICP备2024070905号-1</a>  <a href="https://beian.mps.gov.cn/#/query/webSearch?code=13011102001127" rel="noreferrer" target="_blank"><img src="/uploads/202311/19/231119094931626.png" style="width:20px;height:20px;">冀公网安备13011102001127号</a></p> <p>联系电话:<a href='tel:15032107690'>15032107690</a>   联系QQ:<a href='420220301'>420220301</a>   本站已安全运行: <span id="momk"></span> <script language=javascript> function show_date_time(){ window.setTimeout("show_date_time()", 1000); BirthDay=new Date("2018-05-06 12:00:00");//建站日期 today=new Date(); timeold=(today.getTime()-BirthDay.getTime()); sectimeold=timeold/1000 secondsold=Math.floor(sectimeold); msPerDay=24*60*60*1000 e_daysold=timeold/msPerDay daysold=Math.floor(e_daysold); e_hrsold=(daysold-e_daysold)*-24; hrsold=Math.floor(e_hrsold); e_minsold=(hrsold-e_hrsold)*-60; minsold=Math.floor((hrsold-e_hrsold)*-60); seconds=Math.floor((minsold-e_minsold)*-60); momk.innerHTML=daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒" ; } show_date_time(); </script> <style> #momk{animation:change 10s infinite;font-weight:800; } @keyframes change{0%{color:#5cb85c;}25%{color:#556bd8;}50%{color:#e40707;}75%{color:#66e616;}100% {color:#67bd31;}} </style> </p> <p><a href="/sitemap.txt" target="_blank">网站地图</a>  <a href="/sitemap.xml" target="_blank">XML地图</a>  <a target="_blank" href="https://weibo.com/strtom/">个人微博</a></p> </div></div></footer> <script id="LA-DATA-WIDGET" crossorigin="anonymous" charset="UTF-8" src="https://v6-widget.51.la/v6/3JUiZzzO9lu0KnHY/quote.js?theme=3&f=12"></script> </div> <script> window.tbCtx = { "themeUri": "/wp-content\/themes\/nab", "ajaxUri": "/wp-admin\/admin-ajax.php", "article_swiper": 1, "ver": "2.0", "find_url": "/wp-login.php?action=lostpassword", "event": [], "share_img": "/wp-content\/uploads\/sites\/18\/2023\/07\/5fd0b37cd7dbbb0-e1690186027403-320x200.jpg", "is_home": 0, "blog_url": "", "vercode": 1, "vc_params": "" } </script> <script type='text/javascript' id='main-js-extra'> /* <![CDATA[ */ var tbl = { "img_size": "200", "T001": "待审核", "T002": "回复", "T004": "已复制链接", "T005": "验证码", "T006": "请输入验证码", "T007": "提交", "T008": "验证码错误", "T009": "微信扫码分享", "T010": "登录", "T011": "用户名或邮箱", "T012": "还没有账号?现在", "T013": "注册", "T014": "忘记密码 ?", "T015": "请输入昵称", "T016": "已有账号, ", "T017": "请填写用户名、密码", "T018": "请填写昵称、邮箱、密码", "T019": "昵称是以中文、字母、数字、下划线组合的2-20位字符", "T020": "邮箱格式错误", "T021": "内容不能为空", "T023": "请填写有效的邮箱地址", "T024": "图片格式不正确", "T025": "图片请不超过 %VAR% KB", "T027": "网站名称不能为空,且小于50个字符", "T028": "内容不能为空,且介于10-10000字之间", "T030": "用户名(邮箱)或密码错误", "T031": "你已经登录", "T032": "用户名错误", "T033": "邮箱错误", "T034": "成功登录", "T035": "用户名已存在", "T036": "邮箱已存在", "T037": "注册失败,请稍后再试", "T038": "注册成功", "T040": "退出成功", "T041": "请选择图片", "T042": "图片上传失败,请稍后再试", "T043": "图片上传成功", "T044": "投稿未开启", "T045": "两次投稿时间间隔太短,请稍候再来", "T046": "选择的分类不存在", "T047": "网站名称重复", "T048": "投稿失败,请稍后再试", "T049": "投稿成功,等待审核中", "T050": "url 不存在", "T051": "请在【外观 - 主题设置 - 分享】中设置appID和appsecret", "T052": "当前文章已删除或未发布!", "T053": "评论已关闭!", "T054": "评论成功", "T055": "点赞成功", "T056": "已取消点赞", "T057": "请先登录", "T058": "参数异常,请重试", "T059": "收藏成功", "T060": "已取消收藏", "T061": "密码", "T062": "邮箱", "T063": "密码由8-16位数字、大小写字母组成", "T064": "请输入有效关键词", "T065": "24小时内最多可上传 %VAR% 张图片!", "T066": "请正确填写网址", "T067": "请选择所属分类", "T068": "未开放注册", "T069": "你已赞" }; /* ]]> */ </script> <script type='text/javascript' src='/static/js/main.js' id='main-js'></script> <script type='text/javascript' src='/static/js/comment-reply.min.js' id='comment-reply-js'></script> </body> </html>