当前位置:网站首页>PHP read file (read the specified line containing a string in the file)
PHP read file (read the specified line containing a string in the file)
2022-07-02 05:49:00 【Jill__ er】
The contents of the document
web=/WmCmUr/WmCmUr?wsdl
audit=/secdit/ws/WmCmUr?wsdl
auth=/app/services/AuthSecService?wsdl
Read with “services” That line , And only take the value after the equal sign
/app/services/AuthSecService?wsdl
Realization way :
<?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]));
}
}
}
?>
Show results :
[Running] php 2_duwenjian_2.php
string(33) "/app/services/AuthSecService?wsdl"
边栏推荐
- PHP 开发与测试 Webservice(SOAP)-Win
- Balsamiq wireframes free installation
- 【论文翻译】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond
- 如何写出好代码 — 防御式编程指南
- 5g market trend in 2020
- Go language web development is very simple: use templates to separate views from logic
- With an amount of $50billion, amd completed the acquisition of Xilinx
- Zzuli:1060 numbers in reverse order
- php内类名称与类内方法名相同
- KMP idea and template code
猜你喜欢

Record sentry's path of stepping on the pit

How to write good code - Defensive Programming Guide

Win10 copy files, save files... All need administrator permission, solution

3D printer G code command: complete list and tutorial

文件包含漏洞(二)

Grbl software: basic knowledge of simple explanation

Huawei Hongmeng OS, is it OK?

软件测试基础篇

Disable access to external entities in XML parsing

青训营--数据库实操项目
随机推荐
JVM class loading mechanism
Taskbar explicit / implicit toggle function
Go language web development is very simple: use templates to separate views from logic
Lantern Festival gift - plant vs zombie game (realized by Matlab)
PHP 开发与测试 Webservice(SOAP)-Win
Opencv LBP features
[golang syntax] be careful with the copy of slices
vite如何兼容低版本浏览器
Minimum value ruler method for the length of continuous subsequences whose sum is not less than s
Straighten elements (with transition animation)
Alibaba: open source and self-developed liquid cooling data center technology
I want to understand the swift code before I learn it. I understand it
Ubuntu 20.04 installing mysql8
Fabric. JS round brush
2022-2-14 learning xiangniuke project - Section 7 account setting
软件测试 - 概念篇
“简单”的无限魔方
Sliding window on the learning road
Here comes a new chapter in the series of data conversion when exporting with easyexcel!
Fabric. JS gradient