个性化阅读
专注于IT技术分析

如何在Windows中创建symfony(2或3)项目

Symfony是一个框架, 一套工具和一种开发方法。除工具外, Symfony还是哲学和社区。

既然你已经决定使用最佳的PHP框架之一来加快开发速度, 但是如果你使用的是Windows, 则可能无法理解如何正确创建项目。

从symfony 2开始, SensioLabs决定创建一个symfony安装程序, 以使创建symfony项目更加轻松和动态, 首先我们需要symfony.phar文件(symfony安装程序, 你可以在此处阅读有关安装的更多信息)。

你需要在Windows计算机中安装PHP发行版。

  • 下载symfony.phar文件并将其放在你喜欢的文件夹中(单击此处下载或下载到:https://symfony.com/installer)
  • 然后以管理员身份打开Windows控制台(cmd.exe)。
  • 使用控制台导航到项目所在的路径:
cd C:/thepath/where/you-want-your-project

# Important, do not add the name of the project folder, because symfony.phar will create it
  • 复制你的php可执行文件所在的路径, 然后复制symfony.phar的路径, 然后执行symfony安装程序的命令以创建一个项目:
# the following line will do the trick for you

C:\pathtothephpexecutable\php.exe C:\mypathtosymfony.phar\symfony.phar new theNameOfMyProject

# This will create a folder with the name "theNameOfMyProject" where you are located with the cmd.exe (step 3)

如果要下载特定版本的symfony, 请阅读symfony下载文档, 请记住, 在Windows中, 我们在控制台中替换了symfony关键字, 将其全部替换为php可执行文件的路径, symfony.phar路径以及命令。

重要:根据你的Windows版本, 如果先前的命令不起作用, 则可能需要用双引号将每个可执行路径包装起来, 例如:

"C:\thepathtothephpexecutable\php.exe" "C:\thepathtothesymfony-pharfile\symfony.phar" new "TheNameOfMyProject"

玩得开心 !

赞(0)
未经允许不得转载:srcmini » 如何在Windows中创建symfony(2或3)项目

评论 抢沙发

评论前必须登录!