本帖最后由 mumubangditu 于 2010-09-29 22:38:21 编辑

解决方案 »

  1.   


    $txt="<div id="hear">article</heard><div ...这个是错的。里面的双引号要转义,或者使用单引号需求看着有点复杂,没搞明白
      

  2.   

    前半部分匹配<div class="right"><p>部分我已经会做了,
    得到结果$resault = The apple is the pomaceous food of the apple tree, species Malus domestica in the rose family (Rosaceae) and is a perennial. It is one of the most widely.
    如何把这一句话,进行数据量匹配,根据apple,fruit得出1 fruit apple red 10?是否继续使用preg_match函数?
    preg_match是否可以链接数据库,抓出匹配的文字呢?
    谢谢。
      

  3.   

    每用户只能连续发三次贴,最后顶一次。是否可以先用  $txt1=explode(" ",$txt);  //分解“This is a apple, it is a fruit”这一句句子里的每一个单词,
    然后再
    $query = mysql_query("SELECT * FROM food WHERE name1,name2 like '$txt1[0]' OR name1,name2 like '$txt1[1]‘... ... ); //可能要多写几个$txt1[n]
    把每一个字单独放进数据库里查询?这样做效率是不是很低?这是我这两天想出来的一个比较FOOL的方法,还存在以下2个问题:
    1.当单词是 orange juice 时,上面的方法就会把orange juice看做两个单词给分解开
    2.考虑到句子可能会有N个单词组成,"SELECT WHERElikeOR 需要写上一些。