我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

使用stringpos查找两边都有换行符的字符串不能正常工作

I have this code to search for a string that its both sides has newline but it's not working properly

$pospoint = strpos($pdftxt, "
{$stockcode}
");

It cant find the string if i used above code. Is there other way around this?

Use the constant PHP_EOL instead of " ".
PHP_EOL (End Of Line) will choose what method the string uses as new line (, ) so it's more dynamic than just guessing if it's or

$pospoint = strpos($pdftxt, PHP_EOL.$stockcode.PHP_EOL);

近期文章

  • 无需离开原始页面即可发送数据
  • 在Web服务器上设置文件权限
  • 在wordpress页面中嵌入Tradingview小部件
  • 设计SilverStripe博客模块的最佳方法
  • 洛谷数组入门难度编程题,不想要解题答案,只想知道我的代码错在哪,十分感谢
  • 求助大神,关于C语言数据结构中栈的问题
  • localhost上的SQL注入不起作用
  • 更改foreach循环内的按钮文本
  • 未定义的属性:DOMElement :: $ wholeText
  • SQL更新codeigniter错误不会更新
  • 插入语句,变量失败
  • Symfony3实体字段级别权限
  • 无法从我的EC2实例中提取SQS消息
  • 获取并显示wordpress页面中的摘录帖子
  • 如何将PHP变量传递给Vue指令
  • 自动完成搜索的说明 - Laravel
  • LARAVEL ORM:为每个用户选择DATE以区别
  • dechex没有显示前两个零(rgb到十六进制php)[重复]
  • 如何使用ajax将值传递到另一个页面php
  • 如何为特定文件创建绝对路径?

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华