当前位置:网站首页>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"
}
边栏推荐
猜你喜欢

Vscode paste image plugin saves image path settings

3D 打印机 G 代码命令:完整列表和教程

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

mysql事务和隔离级别
![[technical notes-08]](/img/52/0aff21b01ba7adbfcdb597d1aa85f9.png)
[technical notes-08]

Fabric. JS iText sets the color and background color of the specified text

Fabric. JS iText superscript and subscript

Installation du tutoriel MySQL 8.0.22 par centos8

测试 - 用例篇

Importation de studio visuel
随机推荐
Determine whether there is an element in the string type
正则表达式总结
js判断移动端还是pc端
Grbl software: basic knowledge of simple explanation
死磕大屏UI,FineReport开发日记
3D printer G code command: complete list and tutorial
Brew install * failed, solution
Appnuim environment configuration and basic knowledge
Database batch insert data
php按照指定字符,获取字符串中的部分值,并重组剩余字符串为新的数组
Matplotlib double Y axis + adjust legend position
"Simple" infinite magic cube
Financial portal related information
Common protocols and download paths of NR
Oled12864 LCD screen
简单封装 js并应用
RNN recurrent neural network
Usage record of vector
Installation du tutoriel MySQL 8.0.22 par centos8
Straighten elements (with transition animation)