当前位置:网站首页>php读文件(读取文件内含有某字符串的指定行)
php读文件(读取文件内含有某字符串的指定行)
2022-07-02 05:47:00 【杰儿__er】
文件内容
web=/WmCmUr/WmCmUr?wsdl
audit=/secdit/ws/WmCmUr?wsdl
auth=/app/services/AuthSecService?wsdl
读取含“services”的那一行,且只取等号后的值
/app/services/AuthSecService?wsdl
实现方式:
<?php
$uriFile = "ConfigFile2.conf";
if(file_exists($uriFile))
{
$lines = @file($uriFile);
foreach($lines as $lineStr)
{
//var_dump($lineStr);
/**string(24) "web=/WmCmUr/WmCmUr?wsdl"
string(29) "audit=/secdit/ws/WmCmUr?wsdl"
string(39) "auth=/app/services/AuthSecService?wsdl" */
if(stripos($lineStr, 'services')!==false)
{
var_dump(trim(explode('=', $lineStr)[1]));
}
}
}
?>
显示结果:
[Running] php 2_duwenjian_2.php
string(33) "/app/services/AuthSecService?wsdl"
边栏推荐
- Zzuli:1068 binary number
- Installation du tutoriel MySQL 8.0.22 par centos8
- Fabric. JS iText superscript and subscript
- 文件包含漏洞(一)
- Youth training camp -- database operation project
- Reflection of the soul of the frame (important knowledge)
- Zzuli: maximum Convention and minimum common multiple
- 小程序跳装到公众号
- 2022-2-14 learning xiangniuke project - Section 6 displays login information
- How to write good code - Defensive Programming Guide
猜你喜欢

Brew install * failed, solution

Disable access to external entities in XML parsing

【pyinstaller】_ get_ sysconfigdata_ name() missing 1 required positional argument: ‘check_ exists‘

mysql事务和隔离级别
![[paper translation] gcnet: non local networks meet squeeze exception networks and beyond](/img/7a/718162d08796f70251511101b3a61b.png)
[paper translation] gcnet: non local networks meet squeeze exception networks and beyond

idea開發工具常用的插件合集匯總
![[technical notes-08]](/img/52/0aff21b01ba7adbfcdb597d1aa85f9.png)
[technical notes-08]

【论文翻译】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond

2022-2-14 learning xiangniuke project - Section 7 account setting

青训营--数据库实操项目
随机推荐
[leetcode] day92 container with the most water
Fabric. JS activation input box
数理统计与机器学习
[paper translation] gcnet: non local networks meet squeeze exception networks and beyond
Record sentry's path of stepping on the pit
记录sentry的踩坑之路
ThreadLocal memory leak
GRBL 软件:简单解释的基础知识
kmp思想及模板代码
Fabric. JS iText superscript and subscript
Database batch insert data
1036 Boys vs Girls
Fabric. JS background is not affected by viewport transformation
Determine whether there is an element in the string type
青训营--数据库实操项目
Fabric. JS gradient
mysql的约束总结
How to change the IP address of computer mobile phone simulator
Balsamiq wireframes free installation
Centos8 installation mysql8.0.22 tutorial