Php 将具有哈希()的字符串与数据库进行比较

Php 将具有哈希()的字符串与数据库进行比较,php,symfony,doctrine-orm,Php,Symfony,Doctrine Orm,我有这样的更新查询- $qb = $this->em->createQueryBuilder(); $q = $qb->update('Entities\SocialKeyword', 'u') ->set('u.published', '?1') ->where('u.eventId = ?2') ->andwhere('u.hashtag = ?3') ->setParameter(1,$this->published) ->setPar

我有这样的更新查询-

$qb = $this->em->createQueryBuilder();
$q = $qb->update('Entities\SocialKeyword', 'u')
->set('u.published', '?1')
->where('u.eventId = ?2')
->andwhere('u.hashtag = ?3')
->setParameter(1,$this->published)
->setParameter(2,$this->event_id)
->setParameter(3,$this->hashtag)
->getQuery();
$p = $q->execute();
我的数据库中有一列“hashtag”

当我比较像abcdefgh这样的字符串时,它可以正常工作,但当我比较像这样的散列的字符串时,它不工作

我像这样从URL传递这些参数-

$qb = $this->em->createQueryBuilder();
$q = $qb->update('Entities\SocialKeyword', 'u')
->set('u.published', '?1')
->where('u.eventId = ?2')
->andwhere('u.hashtag = ?3')
->setParameter(1,$this->published)
->setParameter(2,$this->event_id)
->setParameter(3,$this->hashtag)
->getQuery();
$p = $q->execute();
service.shows/index.php/twitter/add_关键字?event_id=33889&hashtag=ijklmnopqaasd&published=1

当我使用“%23”而不是它时,它也不起作用


那么,如何将字符串与哈希标记进行比较。

当你说“它不工作”时,你的确切意思是什么

数据库中存储了什么?带字符还是不带字符的标签


在比较之前,您可能需要对所有传入参数进行URL解码。

使用诸如?hashtag=foo之类的GET参数将不起作用,因为hashtag参数将有一个值。指示您要浏览到foo锚标记。问题是hashtag被解释为,并且没有传递到服务器。。。您需要将hashtag编码为不同的值。您是先进行URL解码吗?是否有其他方法可以做到这一点..?echo$this->hashtag;的输出是什么;?存储在数据库中的字符串既有hashtag,也没有hashtag。