YII Framework框架教程之使用YIIC快速创建YII应用详解
|
本文实例讲述了YII Framework框架使用YIIC快速创建YII应用的方法。分享给大家供大家参考,具体如下: yii提供了强大的命令行工具来快速的创建相关组件和应用。 cd进入yii/framework框架的根目录。 执行 [parameters...]
The following commands are available:
To see individual command help,use the following: 可以看到 yiic的基本命令参数规则 [parameters...] command-name对应的有 - message - migrate - shell - webapp 如果要查看具体的命令的功能可以用 例如: 1.php yiic webapp执行 php yiic help webapp 在指定的位置创建一个基于yii的完整结构的webapp。app-path是webapp的存放目录。如果目录不存在会被创建。 例如: Your application has been created successfully under /yii_dev/testwebap. 生成的目录结构如下
通过浏览器查看一下 http://www.localyii.com/testwebap/ 具体功能后面讲。这里直接讲命令的使用。 2.php yiic messagphp yiic help message打印message命令的相关用法 DESCRIPTION This command searches for messages to be translated in the specified source files and compiles them into PHP arrays as message source. PARAMETERS * config-file: required,the path of the configuration file. You can find an example in framework/messages/config.php. The file can be placed anywhere and must be a valid PHP script which returns an array of name-value pairs. Each name-value pair represents a configuration option. The following options are available: - sourcePath: string,root directory of all source files. - messagePath: string,root directory containing message translations. - languages: array,list of language codes that the extracted messages should be translated to. For example,array('zh_cn','en_au'). - fileTypes: array,a list of file extensions (e.g. 'php','xml'). Only the files whose extension name can be found in this list will be processed. If empty,all files will be processed. - exclude: array,a list of directory and file exclusions. Each exclusion can be either a name or a path. If a file or directory name or path matches the exclusion,it will not be copied. For example,an exclusion of '.svn' will exclude all files and directories whose name is '.svn'. And an exclusion of '/a/b' will exclude file or directory 'sourcePath/a/b'. - translator: the name of the function for translating messages. Defaults to 'Yii::t'. This is used as a mark to find messages to be translated. - overwrite: if message file must be overwritten with the merged messages. */主要用于webapp的国际化。 例如将上面生产的testwebap的 http://www.localyii.com/testwebap/index.php?r=site/login 登录页面的Username和Password 翻译成中文 上面说需要配置文件。yii为我们提供了配置文件的模板。 framework/messages/config.php 复制frameworkmessagesconfig.php 文件到 protectedmessages下 具体内容修改如下: dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'messages','languages'=>array('zh_cn'),'fileTypes'=>array('php'),'overwrite'=>true,'exclude'=>array(
'.svn','yiilite.php','yiit.php','/i18n/data','/messages','/vendors','/web/js',),);
/www/yii_dev/testwebap/protected/views/site/login.php 修改如下 textField($model,'username'); ?> error($model,'username'); ?> labelEx($model,'password')); ?> passwordField($model,'password'); ?> error($model,'password'); ?>(编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
