1
<?php
$site = site_url();
$tec = $site;
$tecget = $site . '/';
$tecgetwo = substr($site, 7);
$gett = get_option('FPMobileget');
if (strpos($gett, "http://www.") === 0) {
$gettt = substr($gett, 11);
$getttc = 'http://' . $gettt;
}
elseif (strpos($gett, "www.") === 0) {
$getwww = substr($gett, 4);
$getwwwc = 'http://' . $getwww;
}
elseif (strpos($gett, "http://") === 0) {
$gethttp = substr($gtt, 7);
}
if (($gett == $tec) || ($gett == $tecget) || ($getwwwc == $tec) || ($getttc == $tec) || ($gett == $tecgetwo)) {
echo "you entered the same url";
echo '<div class="error"><p style="color:#F00">Warning -error</p></div>';
delete_option('FPMobileget');
}
else {
echo "success";
}
?>
我想检查用户url输入与当前网站url是否相同,如果它是相同的我想抛出一个错误消息给用户在管理菜单中同时我想清除文本字段。我使用get_option('FPMobileget')从文本框中获取用户输入。所以当条件满足时,我使用delete_option来清除文本字段(如果url是相同的)。这里用户可能会以不同的方式输入url,所以我已经经历了一些字符串函数来处理这个问题。所有工作正常,但错误消息显示在顶部,但不在文本框旁边。所有在这里工作正常,但我想显示文本框旁边的错误消息多数民众赞成it.this是我的第一个问题在stackoverflow,因为我是新的stackoverflow。提前致谢。如何清除我在wordpress中获得的文本框的值