当前位置:网站首页>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"
}
边栏推荐
- Basic use of form
- Record sentry's path of stepping on the pit
- php按照指定字符,获取字符串中的部分值,并重组剩余字符串为新的数组
- Online music player app
- Zzuli: maximum Convention and minimum common multiple
- Usage record of vector
- 【技术随记-08】
- Disable access to external entities in XML parsing
- Win10 copy files, save files... All need administrator permission, solution
- Uva548 tree
猜你喜欢

Oled12864 LCD screen

Basic use of form

With an amount of $50billion, amd completed the acquisition of Xilinx

vite如何兼容低版本浏览器

《CGNF: CONDITIONAL GRAPH NEURAL FIELDS》阅读笔记

Cambrian was reduced by Paleozoic venture capital and Zhike shengxun: a total of more than 700million cash

How to write good code - Defensive Programming Guide

Disable access to external entities in XML parsing

文件包含漏洞(二)

Minimum value ruler method for the length of continuous subsequences whose sum is not less than s
随机推荐
Huawei Hongmeng OS, is it OK?
php获取cpu使用率、硬盘使用、内存使用
Generate QR code
1035 Password
Practice C language advanced address book design
H5 jump applet
2022-2-14 learning xiangniuke project - Section 7 account setting
Fabric. JS centered element
生成二维码
Usage record of vector
Reflection of the soul of the frame (important knowledge)
Zzuli:1068 binary number
Gcnet: non - local Networks meet Squeeze excitation Networks and Beyond
软件测试基础篇
Common protocols and download paths of NR
数据挖掘方向研究生常用网站
Zzuli:1066 character classification statistics
Software testing learning - day 4
Alibaba: open source and self-developed liquid cooling data center technology
Installation du tutoriel MySQL 8.0.22 par centos8