gpt4 book ai didi

php - 在 Symfony2 项目中的 "post-update-cmd"上运行命令

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:54:12 24 4
gpt4 key购买 nike

运行 composer update 后我需要运行两个命令,一个是调用 .sh 文件的 Linux 控制台命令,第二个是 php 应用程序/控制台 命令。是否可以通过在 composer.json 文件中做一些事情来实现?我注意到这一行:

"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
]

但是不知道这样对不对。以第一个命令为例:/home/data.sh 和第二个命令php app/console doctrine:fixtures:load --append,有什么建议吗?

最佳答案

您可以像这样在 post-update-cmd 指令中包含这些命令:

"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"/home/data.sh",
"php app/console doctrine:fixtures:load --append"
]

更多信息:https://getcomposer.org/doc/articles/scripts.md

关于php - 在 Symfony2 项目中的 "post-update-cmd"上运行命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23171449/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com