$str = str_replace("\", """,$str);

解决方案 »

  1.   

    $tt = str_replace('"','"',$tt);
      

  2.   

    这两种有什么区别,能帮我解释一下嘛?
    $tt = str_replace('"','"',$tt); $str = str_replace("\", """,$str);
      

  3.   

    这两种有什么区别,能帮我解释一下嘛?
    $tt = str_replace('"','"',$tt); $str = str_replace("\", """,$str);
    -===========================
    没区别吧。
      

  4.   

    $a = addslashes($string);
    $a = stripslashes($string);
      

  5.   

    echo $re["name"];
    $t->setvar("name",stripslashes($re["name"]));输出的name是:
    Toshiba Satellite PSA60U-02201D Cel 2.8GHz 15\" 256MB 40GB Combo WinXP Pro Notebook 但是,给了文本框,文本框却还是到"引号之前,引号之后的就没了。
    <input name="name" type="text" id="name2" value="{name}" >为什么嘛??
      

  6.   

    引号呢?
    <input type=text value = 'Sony VAIO V505 PCG-V505DC1PC 12.1" Notebook Computer'>标准的写法是
    <input type=text value = "Sony VAIO V505 PCG-V505DC1PC 12.1&quot; Notebook Computer">
      

  7.   


    function decodeHtmlChar($value)
    {
    $tt = $value;
    $tt = str_replace('','amp;',$tt);
    $tt = str_replace("'",'&#039;',$tt);
    $tt = str_replace('"','&quot;',$tt);
    $tt = str_replace('<','&lt;',$tt);
    $tt = str_replace('>','&gt;',$tt);
    return $tt;
    }
    ///////////////////////////////
    echo $re["name"];
    echo "<br>";
    echo stripslashes($re["name"]);
    echo "<br>";
    echo decodeHtmlChar($re["name"]);结果
    Toshiba Satellite PSA60U-02201D Cel 2.8GHz 15\" 256MB 40GB Combo WinXP Pro Notebook
    Toshiba Satellite PSA60U-02201D Cel 2.8GHz 15" 256MB 40GB Combo WinXP Pro Notebook
    Toshiba Satellite PSA60U-02201D Cel 2.8GHz 15\" 256MB 40GB Combo WinXP Pro Notebook 
    可是文框内却是
    Toshiba Satellite PSA60U-02201D Cel 2.8GHz 15引号怎么不会变成&quot;????
      

  8.   

    我知道了
    我把<input name="name" type="text" id="name2" value="{name}" >
    改成
    <input name="name" type="text" id="name2" value='{name}'>
    文本框内就显示出所有的来了。可是,我不想这样改。。不要改这个。而是通过name传过来的值就可以用。怎么办?
      

  9.   

    我知道了,,,
    我把原来的
    function decodeHtmlChar($value)
    {
    $tt = $value;
    $tt = str_replace('amp;','',$tt);
    $tt = str_replace('&#039;',"'",$tt);
    $tt = str_replace('&quot;','"',$tt);
    $tt = str_replace('&lt;','<',$tt);
    $tt = str_replace('&gt;','>',$tt);
    return $tt;
    }
    这样子的反过来成那样子的。
    function decodeHtmlChar($value)
    {
    $tt = $value;
    $tt = str_replace('','amp;',$tt);
    $tt = str_replace("'",'&#039;',$tt);
    $tt = str_replace('"','&quot;',$tt);
    $tt = str_replace('<','&lt;',$tt);
    $tt = str_replace('>','&gt;',$tt);
    return $tt;
    }
    后来,就可以了。。
    你们开始还告诉我是一样的。。为什么我反的就可以???好像还是不能理解。。
      

  10.   

    喂,lzkd(浪子快刀),你什么意思嘛?
    要说人家笨的话就直说。。我不会介意的呀。
      

  11.   

    哦...楼主不要误会.....因为觉得楼主的风格挺熟的,刚才狂想了半天,搜索了以前的帖子,想起
    以前我回答过你一个帖,关于session的.只是觉得挺有意思,绝对没有
    别的,我保证..呵...
      

  12.   

    你要的是这个?str_replace
    字符串取代。语法: string str_replace(string needle, string str, string haystack);返回值: 字符串函数种类: 资料处理
     
     
    内容说明 
    本函数将字符串 str 代入 haystack 字符串中,将所有的 needle 置换成 str。[email protected] (11-Apr-1999) 指出在 PHP 3.0.7 版,本函数有些 bug,而 [email protected] (05-Jun-1999) 补充在 PHP 3.0.8 版本函数就回复正常了。
     
     
    使用范例 
    下例将 %body% 以 black 取代<?php
    $bodytag = str_replace("%body%", "black", "<body text=%body%>");
    echo $bodytag;
    ?>