当前位置:网站首页>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"
边栏推荐
猜你喜欢
随机推荐
Disable access to external entities in XML parsing
H5 jump applet
JVM class loading mechanism
Zzuli:1069 learn from classmate Z
Gcnet: non - local Networks meet Squeeze excitation Networks and Beyond
all3dp.com网站中全部Arduino项目(2022.7.1)
测试 - 用例篇
Pytorch Chinese document
[technical notes-08]
php数组转化为xml
Straighten elements (with transition animation)
我所理解的DRM显示框架
Software testing learning - day 4
Visual Studio導入
Record sentry's path of stepping on the pit
“簡單”的無限魔方
7. Eleven state sets of TCP
Simply encapsulate JS and apply it
I want to understand the swift code before I learn it. I understand it
Centos8 installation mysql8.0.22 tutorial