我无法按照 Symfony 文档中所述创建新的 Symfony 项目:https://symfony.com/doc/4.3/setup.html
这是我使用的命令:symfony new --full my_project
输出:
$ symfony new --full my_project
WARNING The current directory seems configured for as a SymfonyCloud project, but it is not linked yet.
You can link this directory to an existing project: symfony link [project-id] (get project IDs via symfony projects)
* Creating a new Symfony project with Composer
unable to find composer, get it at https://getcomposer.org/download/: exec: "composer": executable file not found in
$PATH
Run Code Online (Sandbox Code Playgroud)
我不明白为什么该命令找不到 Composer 可执行文件。
当我刚进入 …
对于学校项目,我正在Laravel框架中创建一个网站.我无法处理控制器中多对多表中的数据.
这是我的模特:
class Item extends Eloquent {
public function Tags()
{
return $this->belongsToMany('Tag', 'items_has_tags', 'items_id', 'tags_id');
}
}
class Tag extends Eloquent {
public function LearningMaterials()
{
return $this->belongsToMany('LearningMaterial', 'learning_materials_has_tags', 'tags_id', 'learning_materials_id');
}
}
Run Code Online (Sandbox Code Playgroud)
我想迭代我控制器中项目的所有标签:
//get all items
$all = Item::where('public', '1')->get();
foreach($allLm as $item){
$tags = $item->Tags();
var_dump('will iterate');
foreach($tags as $t){
var_dump('will not iterate');
}
}
Run Code Online (Sandbox Code Playgroud)
我的代码出了什么问题?如何处理我的物品中的标签?
仅供参考:我正在创建一个搜索引擎.如果用户插入类似"mana"的输入值,则应显示带有"management"标签的所有项目.