duanbiyi7319 2012-10-03 04:53 采纳率: 100%
浏览 13
已采纳

使用preg_replace附加值

Assume i have the following hrefs:

.... href="http://localhost/centboox/usedtextbooks/desc/30" ....

I would like to through all of them and add ** just before closing the href's double quotation:

... href="http://localhost/webname/pagename/desc/30*******" ...

Asterisks represent some input e.g. ?q=all&a=search_text

How can i do this via preg_replace in PHP.

Thanks

  • 写回答

4条回答 默认 最新

  • douqudi5282 2012-10-03 04:55
    关注
    $result = preg_replace('/href="[^"]*/', '\0********', $subject);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?