Home  >  Article  >  Backend Development  >  PHP中关于strstr函数查找 /n特殊字符?

PHP中关于strstr函数查找 /n特殊字符?

WBOY
WBOYOriginal
2016-06-06 20:15:091283browse

我现在的代码 找不到 /n 字符

PHP中关于strstr函数查找 /n特殊字符?

PHP中关于strstr函数查找 /n特殊字符?

请问如何找到嗯?


扔上来的代码

<code>$xml = simplexml_load_file("ZH-CNstrings.xml");

// echo $xml->getName() . "<br>";
$cou = 1;
foreach($xml->children() as $child)
{        echo $child->getName();
    if($child->getName() == "string-array"){
        foreach ($child as $key2 => $value2) {
            echo "<input type="text" name='".$value2["name"]."' value='".$value2."' style=" width: 500px; "><br>";
        }
    }else{

        if (strstr($child,"color") 
            or strstr($child,"%1")
            or strstr($child,"%s")
            or strstr($child,"\n")
            ) {
            echo "<b style="color: #f0f;">有 特殊字符 </b>";
        $cou++;
    }

    echo "<input type="text" name='".$child["name"]."' value='".$child."' style=" width: 500px; "><br>";
}
}</code>

回复内容:

我现在的代码 找不到 /n 字符

PHP中关于strstr函数查找 /n特殊字符?

PHP中关于strstr函数查找 /n特殊字符?

请问如何找到嗯?


扔上来的代码

<code>$xml = simplexml_load_file("ZH-CNstrings.xml");

// echo $xml->getName() . "<br>";
$cou = 1;
foreach($xml->children() as $child)
{        echo $child->getName();
    if($child->getName() == "string-array"){
        foreach ($child as $key2 => $value2) {
            echo "<input type="text" name='".$value2["name"]."' value='".$value2."' style=" width: 500px; "><br>";
        }
    }else{

        if (strstr($child,"color") 
            or strstr($child,"%1")
            or strstr($child,"%s")
            or strstr($child,"\n")
            ) {
            echo "<b style="color: #f0f;">有 特殊字符 </b>";
        $cou++;
    }

    echo "<input type="text" name='".$child["name"]."' value='".$child."' style=" width: 500px; "><br>";
}
}</code>

试试 \n

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn