question:
I am using the lightning strike net custom form. In the rich text submitted to the backend, I extract the string of the html tag in the rich text string, and then I want to replace the html tag string in the rich text string with a space (that is, delete ~), so I confidently use the strripos (), result to get the return value of false, that is, the string B that clearly exists in string A. But I can"t tell where he is, so I can"t achieve the goal of replacing B.
/* */
foreach ($form as $v) {
$needle = $v["content"];
// var_dump($needle);
// $needle = "<input";
// echo "=>".$contents." <br> =>".$needle;
var_dump($contents);
var_dump($needle);
$start = stripos($contents, $needle);//TODO
if ($start!=false) {
$length = strlen($needle);
echo "" . $contents . "--------------$start=" . $start . ",$length=" . $length . "<br>";
$contents = $this->str_replace_once($needle, "", $contents);// html
// $contents = substr_replace($contents, "", $start, $length);
// echo "=" . $contents . "<br>";
}
}
above code: replace needle with a blank string from contents.
var_dump($contents);==>
string(204) "asdfasdf
<input name="leipiNewField" type="text" title="fdasfd" value="" leipiplugins="text" orghide="0" orgalign="left" orgwidth="150" orgtype="text" style="text-align: left; width: 150px;"/>
"
var_dump($needle);==>string(184) "
<input name="leipiNewField1" type="text" title="fdasfd" value="" leipiplugins="text" orghide="0" orgalign="left" orgwidth="150" orgtype="text" style="text-align: left; width: 150px;"/>"
Rich text submitted: