shiftpi / country-flags
此包已废弃,不再维护。未建议替换包。
提供访问各种国家国旗的权限
0.1.2
2014-07-23 20:02 UTC
Requires
- php: >=5.3.3
- zendframework/zendframework: 2.*
Requires (Dev)
- phpunit/phpunit: ~4.1
This package is not auto-updated.
Last update: 2021-08-06 23:27:27 UTC
README
#ShiftpiCountryFlags 提供访问各种国家国旗的权限
安装
使用Composer
在您的composer.json
文件中要求shiftpi/country-flags
。然后更新您的依赖关系。您现在可以在config/application.config.php
文件中启用模块
// ... 'modules' => array( // ... 'ShiftpiCountryFlags', // ... ), // ...
如果您使用的是Windows,请确保已加载php_fileinfo.dll
。
配置
将vendor/shiftpi/country-flags/config/shiftpicountryflags.global.php.dist
复制到config/autoload/shiftpicountryflags.global.php
。
编辑配置文件(如有需要)
return array( 'countryflags' => array( 'mapper' => 'ShiftpiCountryFlags\Mapper\Filename', // country code -> file path mapper 'datapath' => '/alternative/data/path', // new since 0.1.1; optional ), );
使用方法
路由
默认情况下,该模块提供访问国旗的路由
/countryflags/<countrycode>[/<size>]
其中countrycode是ISO 3166 ALPHA-2代码(见https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)。大小定义了国旗的宽度和高度(单位:px)。可能的值是16、24、32、48、64。默认值是16。
视图助手
<img src="<?php echo $this->countryFlagUrl('SC', 64) ?>" alt="Seychelles" width="64" />
其中第二个参数(大小)是可选的(默认16)。
许可证
根据MIT许可证授权。见许可证文件。国旗图标来自http://www.gosquared.com/(也根据MIT许可证授权)。