当前位置:网站首页>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"
边栏推荐
- KMP idea and template code
- "Original, excellent and vulgar" in operation and maintenance work
- Minimum value ruler method for the length of continuous subsequences whose sum is not less than s
- Zzuli:1066 character classification statistics
- brew install * 失败,解决方法
- Lingyunguang rushes to the scientific innovation board: the annual accounts receivable reaches 800million. Dachen and Xiaomi are shareholders
- 死磕大屏UI,FineReport开发日记
- 【LeetCode】Day92-盛最多水的容器
- all3dp. All Arduino projects in com website (2022.7.1)
- Innovation never stops -- the innovation process of nvisual network visualization platform for Excel import
猜你喜欢
![Gee series: unit 10 creating a graphical user interface using Google Earth engine [GUI development]](/img/78/a17034d4b77d5c0dbe741f84a8ecd7.jpg)
Gee series: unit 10 creating a graphical user interface using Google Earth engine [GUI development]

Opencv LBP features

6. Network - Foundation

记录sentry的踩坑之路

A collection of commonly used plug-ins for idea development tools

Lantern Festival gift - plant vs zombie game (realized by Matlab)

Technologists talk about open source: This is not just using love to generate electricity

Ls1046nfs mount file system

Operator details

vite如何兼容低版本浏览器
随机推荐
Conglin environmental protection rushes to the scientific and Technological Innovation Board: it plans to raise 2billion yuan, with an annual profit of more than 200million yuan
Generate QR code
【論文翻譯】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond
Php/js cookie sharing across domains
[paper translation] gcnet: non local networks meet squeeze exception networks and beyond
Sliding window on the learning road
Get the details of the next largest number
Straighten elements (with transition animation)
Fabric. JS compact JSON
Vite打包后的dist不能直接在浏览器打开吗
Minimum value ruler method for the length of continuous subsequences whose sum is not less than s
Online English teaching app open source platform (customized)
2022-2-14 learning xiangniuke project - section 23, section 5, development login and exit functions
Simply encapsulate JS and apply it
Online music player app
Fabric. JS gradient
Matplotlib double Y axis + adjust legend position
1036 Boys vs Girls
460. LFU 缓存 双向链表
Pytorch Basics