在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
php 两段文本对比,不同的文字显示高亮【下面这个只能区分错误后面的..】
<?php $str1 ="MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDFUUnBVaHOzlXb Gn3gA+GGpUOdI9yhzKQ0q2vEFLVA+JD7KN9+pzA2Iyfoc1Ldd9WPe7hhxyc22Egg 4BP/mNPfoEbDbshtRUxgR/RoyF4xtw4wFfES26dv3K3wWoueUg5BHtsMXd9qwRew 83JZutNXGL2Wj581buFlvlHb38COjVG/BdEYBuLVDhzqj7cA//ECUrMtVc756kw/ ppa0OHfvlCqSkaru2EEK6RW+UXkWrBH/W7iQzCgi3H9ddgp0M+JcfBwfdSdILthh FrTBYWoVGOmrPqFJxPp4SZA7xWozpWypzV9EuOgNDWUVXyq0hJj3HeVZDPan1DxH G8fwFmoHAgMBAAECggEAbqAHcNxYroCiRAgTQHAMlhe707MSdKgt+9WLwtA1WqrB Zf7hZrnHXuLQ8hMOB1qzIhGkKzWjt60Eq2HV9HwzdXH/mnxW5GRw0J4m2kRUAx11 V+JFWWRK+H1KC7JICshIc5wgBUvwAYMmjC/BEaub533YdTwqb6OtvQQ6EsLcy05U EMko7irwEI3AXnrSz9jJmCQWhUr2cxDf0YBWJ1Uu2fc7ZsXc/zGJAIq4qHWLVHYy rlZ6uyZFFtn2ibuKu8k9ehownpQWVmFl1lHDfBSx9kcfPqHBbZFD5c1A4lsxYYlQ hv6ElTMdU95r/nw0xt0dWgERazD66HX+C/QYo5sxaQKBgQD9Q3FbeG4lX4xVl71X IUwLXBKnZaOCBkan5VWoEzrCJUIKWSWIs5md77Yf89ZqOrJFSRaoRoVQCF7wuxPX l1ZviCnMC/bBgobBFwo2L20140EDwrkYEWzM6llLltTNfGYLng/jW64aY0P0mymT QK4BdwoLArlU7eI9PTU0mt+CAwKBgQDHcxeX31k14rbCM3CNKB3m08/It46Lz4S3 A/88X1mCm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KLN KlkEOdJMMdlmulc0gA1yNZB47NqOf/Otfdpv/aQ2iFSKcB5jMLbZ/cN+XMpKCcvC 3Im9LOJqssp12kjO9Bin62VX4mxEp5JudodvWnolM+4TOj0WikzP1sw0zXZa7UWh Qwdn72MC+lZHonkiXnkmAw=="; echo $str1.'<hr />'; $err=mb_str_cmp($str1,$str2,'utf-8'); echo $err[0].'<font color="red">'.$err[1].'</font>'; //字符串比较,返回的第二个字符串的数组,0为相同部分,1为不同 function mb_str_cmp($str1,$str2,$encode='utf-8'){ $num=mb_strlen($str2,$encode); if(strcmp($str1,$str2)==0)return array($str2,''); for($i=0;$i<$num;$i++){ $word1=mb_substr($str1,$i,1,$encode); $word2=mb_substr($str2,$i,1,$encode); if($word1!=$word2)break; } return array(mb_substr($str2,0,$i,$encode),mb_substr($str2,$i,$num,$encode)); }
|
2022-08-16
2022-11-06
2022-08-18
2022-08-15
2022-08-15
请发表评论