[英]Install older version of Yaml (1.3.1) for PHP 5.5.9
I tried to install yaml by using this commands 我试图通过使用此命令来安装yaml
sudo apt-get install php-pear libyaml-dev
sudo pecl install yaml
But this YAML requires php7.0 and newer version. 但是,此YAML需要php7.0和更高版本。 I use PHP 5.5.9 How can install older version of YAML.
我使用PHP 5.5.9如何安装旧版本的YAML。
You should change your package repository (For example in Debian/Ubuntu Aptitude repositories), for PHP5 versions and then install that version or YAML. 您应该更改PHP5版本的软件包存储库(例如,在Debian / Ubuntu Aptitude存储库中),然后安装该版本或YAML。
You can use also Composer for the dependencies management, or the "hardest" way, download the source code and implement by yourself. 您也可以使用Composer进行依赖项管理,或者以“最困难的方式”下载源代码并自己实现。
echo "deb http://packages.dotdeb.org wheezy-php56 all" >> /etc/apt/sources.list.d/dotdeb.list
echo "deb-src http://packages.dotdeb.org wheezy-php56 all" >> /etc/apt/sources.list.d/dotdeb.list
wget http://www.dotdeb.org/dotdeb.gpg -O- |apt-key add -
apt-get update
apt-get install php-pearl ....
As delboy1978uk suggested I had tried with Symfony 正如delboy1978uk所建议的那样,我曾尝试过Symfony
Stevan, check this section, the composer lib can also write as well as read and parse.
Stevan,请检查本节,作曲家的lib也可以编写,读取和解析。 symfony.com/doc/current/components/yaml.html#writing-yaml-files – delboy1978uk
symfony.com/doc/current/components/yaml.html#writing-yaml-files – delboy1978uk
This is my working solution 这是我的工作解决方案
$arr = array(
'parameters' => array(
'stage' => array(
'host' => 'host',
'username' => 'username',
'password' => 'password'
),
'live'=> array(
'host' => 'host',
'username' => 'username',
'password' => 'password'
),
)
);
$yaml = Yaml::dump($arr, 3);
file_put_contents('parameters.yml', $yaml);
This code outputs 该代码输出
parameters:
stage:
host: sasass
username: dsdadsd
password: password
live:
host: sasass
username: dsdadsd
password: password
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.