Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.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 谷歌材料图标作为数组-有什么想法吗?_Php_Arrays_Icon Fonts - Fatal编程技术网

Php 谷歌材料图标作为数组-有什么想法吗?

Php 谷歌材料图标作为数组-有什么想法吗?,php,arrays,icon-fonts,Php,Arrays,Icon Fonts,我正在我的应用程序中实现Google材质图标- 我希望能够填充一个select字段,以便它显示图标的名称或图标本身,而选项的值是数字字符引用(因此它与不支持连字的浏览器兼容-即

我正在我的应用程序中实现Google材质图标-

我希望能够填充一个
select
字段,以便它显示图标的名称或图标本身,而
选项的
是数字字符引用(因此它与不支持连字的浏览器兼容-即<10)

我想将所有图标放入一个数组中,以便生成
选择
选项
元素。所以,这类事情:

$icons = array(
    "&#xE84D;" => "3d rotation",
    "&#xE84E;" => "accessibility",
    etc. etc.
);

我不想坐下来用所有750个项目手动创建这个数组,所以我想知道是否有人对自动化方法有什么想法?

我已经设法以半自动化的方式完成了这项工作

这是为可能需要它的任何其他人准备的阵列:


希望这对别人有帮助

我已经设法以半自动化的方式完成了这项工作

这是为可能需要它的任何其他人准备的阵列:


希望这对别人有帮助

您可以加载字体附带的
MaterialIcons Regular.ijmap
json文件

PHP示例显示:

// Get the contents on the ijmap bundled with the icon font
$list = json_decode(file_get_contents('path/to/MaterialIcons-Regular.ijmap'), true);
$icons = []; 

foreach ($list['icons'] as $i => $data) {
    $icons[$i] = $data['name']; 
}

您可以加载字体附带的
MaterialIcons Regular.ijmap
json文件

PHP示例显示:

// Get the contents on the ijmap bundled with the icon font
$list = json_decode(file_get_contents('path/to/MaterialIcons-Regular.ijmap'), true);
$icons = []; 

foreach ($list['icons'] as $i => $data) {
    $icons[$i] = $data['name']; 
}

我甚至不知道这个文件存在!非常感谢,每次谷歌添加新字体时,你都为我节省了几个小时。我甚至都不知道这个文件存在!非常感谢,每次谷歌添加新字体时,你都为我节省了几个小时。