当前位置:网站首页>PHP read file (read JSON file, convert to array)
PHP read file (read JSON file, convert to array)
2022-07-02 05:49:00 【Jill__ er】
The contents of the document
{
"address":"192.168.1.0",
"RemotePort":"10081"
}
Format after reading
array(2) {
'address' =>
string(11) "192.168.1.0"
'RemotePort' =>
string(5) "10081"
}
Realization way :
<?php
$config = array();
// Print the contents of the read file
var_dump(file_get_contents("ConfigFile1.conf"));
// Format conversion of the read file contents
$config = json_decode(file_get_contents("ConfigFile1.conf"), true);
var_dump($config);
?>
Show results :
[Running] php 1_duwenjian_1.php
string(51) "{
"address":"192.168.1.0",
"RemotePort":"10081"
}"
array(2) {
'address' =>
string(11) "192.168.1.0"
'RemotePort' =>
string(5) "10081"
}
边栏推荐
- Get the details of the next largest number
- Fabric. JS iText sets the color and background color of the specified text
- Visual studio import
- Usage record of vector
- 6. Network - Foundation
- “简单”的无限魔方
- Zzuli:1067 faulty odometer
- 青训营--数据库实操项目
- Oled12864 LCD screen
- How to write good code - Defensive Programming Guide
猜你喜欢
随机推荐
中小型项目手撸过滤器实现认证与授权
php继承(extends)
Two implementation methods of delay queue
Oled12864 LCD screen
php父类(parent)
[Chongqing Guangdong education] selected reading reference materials of British and American literature of Nanyang Normal University
With an amount of $50billion, amd completed the acquisition of Xilinx
文件包含漏洞(一)
php数组转化为xml
Fabric. JS basic brush
Technologists talk about open source: This is not just using love to generate electricity
h5跳小程序
Visual studio import
Ls1046nfs mount file system
XSS basic content learning (continuous update)
Fabric. JS gradient
“简单”的无限魔方
RNN recurrent neural network
Zzuli:1060 numbers in reverse order
Zzuli:1062 greatest common divisor








