Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将TYPO3打字脚本常量文件转换为数组或JSON格式?_Php_Arrays_Json_Typo3_Typoscript - Fatal编程技术网

Php 如何将TYPO3打字脚本常量文件转换为数组或JSON格式?

Php 如何将TYPO3打字脚本常量文件转换为数组或JSON格式?,php,arrays,json,typo3,typoscript,Php,Arrays,Json,Typo3,Typoscript,下面是我的TYPO3打字脚本常量文件,我想使用php将该文件转换为数组格式。(我使用的是Laravel 5.5框架) 这是我的constant.ts文件: settings { social { # cat=jay: advanced/120/100; type=integer; label=Facebook page facebook = http://www.facebook.com # cat=jay: advanced/120/110; type=intege

下面是我的TYPO3打字脚本常量文件,我想使用php将该文件转换为数组格式。(我使用的是Laravel 5.5框架)

这是我的constant.ts文件:

settings {
  social {
    # cat=jay: advanced/120/100; type=integer; label=Facebook page
    facebook = http://www.facebook.com
    # cat=jay: advanced/120/110; type=integer; label=Twitter account
    twitter = https://twitter.com
    # cat=jay: advanced/120/120; type=integer; label=Google Plus Account
    google = https://plus.google.com
    # cat=jay: advanced/120/130; type=integer; label=Direct Mail
    mail = jay@gmail.com
  }

  # cat=jay: advanced/120/140; type=string; label=Path to logo file
  logo = 
}
我在做什么:
我使用

$jsonString = file_get_contents(storage_path() . "/jay/Configuration/TypoScript/Constants/Settings.ts");

那么,如何将该文件转换为正确的数组或JSON格式呢?

您可以从核心函数中解析它。 查看API,我会考虑:


您是否需要直接从常量中获取,或者从已解析的打字稿配置中获取?您好@u\u mulder谢谢您的建议。但是我想通过使用LaravelPHP而不是typo3来转换这个文件json或数组格式。那么如何使用编码转换这个文件呢?帮助我。Hello@jokumer我只使用了typo3常量文件而不是整个结构我没有使用typo3,但我使用了typo3常量文件来读取该变量并在Laravel(PHP)中转换为json或数组格式。