akturan / plistparser
用于读取和解析 XML Plist 文件的 PHP 类
v1.1
2017-03-01 15:02 UTC
Requires
- php: ^5.3.3 || ^7.0
This package is not auto-updated.
Last update: 2024-09-18 20:39:24 UTC
README
用于读取和解析 XML Plist 文件的 PHP 类
安装
使用 Composer 安装。
composer require akturan/plistparser
快速使用
require_once 'PlistParser.php';
将 Plist 转换为数组
$result = $plistParser->plistToArray("Info.plist");
结果
Array
(
[CFBundleAllowMixedLocalizations] => 1
[CFBundleDevelopmentRegion] => de_DE
[CFBundleDisplayName] => Test
[CFBundleExecutable] => ${EXECUTABLE_NAME}
[CFBundleIcons] => Array
(
[UINewsstandIcon] => Array
(
[CFBundleIconFiles] => Array
(
[0] => 1.png
[1] => 1@2x.png
)
[UINewsstandBindingEdge] => UINewsstandBindingEdgeBottom
[UINewsstandBindingType] => UINewsstandBindingTypeNewspaper
)
)
[UIPrerenderedIcon] => 1
[UIRequiredDeviceCapabilities] => Array
(
[0] => armv7
)
[UIRequiresFullScreen] => 1
[UISupportedInterfaceOrientations] => Array
(
[0] => UIInterfaceOrientationPortrait
[1] => UIInterfaceOrientationLandscapeLeft
[2] => UIInterfaceOrientationLandscapeRight
)
[UISupportedInterfaceOrientations~ipad] => Array
(
[0] => UIInterfaceOrientationPortrait
[1] => UIInterfaceOrientationPortraitUpsideDown
[2] => UIInterfaceOrientationLandscapeLeft
[3] => UIInterfaceOrientationLandscapeRight
)
[UIViewControllerBasedStatusBarAppearance] =>
)
在 Plist 文件中搜索关键字
$result = $plistParser->searchKeyInPlist("Info.plist", "CFBundleDisplayName");
// Test