当前位置:网站首页>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"
边栏推荐
- 金融门户相关信息
- brew install * 失败,解决方法
- Cambrian was reduced by Paleozoic venture capital and Zhike shengxun: a total of more than 700million cash
- 2022-2-14 learning xiangniuke project - section 23, section 5, development login and exit functions
- ThreadLocal memory leak
- Fabric. JS basic brush
- Straighten elements (with transition animation)
- Fabric. JS free draw rectangle
- Online music player app
- XSS basic content learning (continuous update)
猜你喜欢
![[personal test] copy and paste code between VirtualBox virtual machine and local](/img/ce/eaf0bd9eff6551d450964da72e0b63.jpg)
[personal test] copy and paste code between VirtualBox virtual machine and local

Fabric. JS compact JSON

Oled12864 LCD screen

brew install * 失败,解决方法

【pyinstaller】_ get_ sysconfigdata_ name() missing 1 required positional argument: ‘check_ exists‘
![Gee series: unit 9 generate sampling data in GEE [random sampling]](/img/ff/edb27b40f63eca81c5683e81b2860b.jpg)
Gee series: unit 9 generate sampling data in GEE [random sampling]

Visual Studio導入

ThreadLocal memory leak

Résumé de la collection de plug - ins couramment utilisée dans les outils de développement idea

Fabric. JS iText superscript and subscript
随机推荐
js判断移动端还是pc端
Fabric. JS compact JSON
Fabric. JS iText sets the color and background color of the specified text
I want to understand the swift code before I learn it. I understand it
【LeetCode】Day92-盛最多水的容器
How matlab marks' a 'in the figure and how matlab marks points and solid points in the figure
Fabric. JS gradient
Vite打包后的dist不能直接在浏览器打开吗
Brew install * failed, solution
软件测试答疑篇
Here comes a new chapter in the series of data conversion when exporting with easyexcel!
Lantern Festival gift - plant vs zombie game (realized by Matlab)
【论文翻译】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond
"Original, excellent and vulgar" in operation and maintenance work
记录sentry的踩坑之路
Installation du tutoriel MySQL 8.0.22 par centos8
Grbl software: basic knowledge of simple explanation
Gee series: unit 7 remote sensing image classification using GEE [random forest classification]
Zzuli:1066 character classification statistics
The Hong Kong Stock Exchange learned from US stocks and pushed spac: the follow-up of many PE companies could not hide the embarrassment of the world's worst stock market