Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php CONCAT到CONCAT两个$\u GET函数_Php_Symfony_Dql - Fatal编程技术网

Php CONCAT到CONCAT两个$\u GET函数

Php CONCAT到CONCAT两个$\u GET函数,php,symfony,dql,Php,Symfony,Dql,*我在教义中写过这样的插入代码 $social=新实体\SocialKeyword $social->setEventId($_GET["eventId"]); $social->setHashtag($_GET["hashtag"]); $this->em->persist($social); $this->em->flush(); 现在我想合并$_-GET[“eventId”]和$_-GE

*我在教义中写过这样的插入代码 $social=新实体\SocialKeyword

        $social->setEventId($_GET["eventId"]);
        $social->setHashtag($_GET["hashtag"]);

        $this->em->persist($social);
        $this->em->flush();
现在我想合并$_-GET[“eventId”]和$_-GET(hashtag),两者都用“-”分隔,并将其插入表中的素数列中

我是这样写的,但它不起作用

$social->setPrime(CONCAT($_GET["eventId"],'-', $_GET["hashtag"]));
需要帮助。

首先
$\u GET(hashtag)
看起来有问题,应该
$\u GET[“hashtag”]
。简单使用点
(.)
运算符进行字符串连接

$_GET["eventId"] . '-' . $_GET["hashtag"]
在代码中

$social->setPrime($_GET["eventId"] . '-' . $_GET["hashtag"]);

在PHP中,连接运算符是('.'),但您使用了(',')。 试试这个:

$concate_value = $_GET["eventId"].'-'.$_GET["hashtag"];
$social->setPrime($concate_value);

这个问题似乎离题了,因为OP对所使用的语言没有最低限度的了解,而且显然没有搜索网络。