当前位置:网站首页>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"
}
边栏推荐
- Here comes a new chapter in the series of data conversion when exporting with easyexcel!
- 1037 Magic Coupon
- Typora installation (no need to enter serial number)
- 中小型项目手撸过滤器实现认证与授权
- Applet jumps to official account
- 我所理解的DRM显示框架
- Appnuim environment configuration and basic knowledge
- GRBL 软件:简单解释的基础知识
- 金融门户相关信息
- 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
猜你喜欢
随机推荐
php获取cpu使用率、硬盘使用、内存使用
Online music player app
Ubuntu 20.04 installing mysql8
2022-2-14 learning xiangniuke project - Section 6 displays login information
Fabric. JS compact JSON
7. Eleven state sets of TCP
Alibaba: open source and self-developed liquid cooling data center technology
死磕大屏UI,FineReport开发日记
How to write good code - Defensive Programming Guide
Grbl software: basic knowledge of simple explanation
【LeetCode】Day92-盛最多水的容器
kmp思想及模板代码
测试 - 用例篇
GRBL 软件:简单解释的基础知识
With an amount of $50billion, amd completed the acquisition of Xilinx
Gcnet: non - local Networks meet Squeeze excitation Networks and Beyond
5g market trend in 2020
Disable access to external entities in XML parsing
Win10 copy files, save files... All need administrator permission, solution
Yyds dry inventory what is test driven development








