亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在 if 條件內對 preg 匹配進行多變量控制?

如何在 if 條件內對 preg 匹配進行多變量控制?

PHP
茅侃侃 2023-03-04 14:32:35
我檢查了 post 方法附帶的輸入。但是這個 if 條件代碼不起作用。編輯:否則落在他的街區是JavaScript$(".inputonlytext").keypress(function(e) {    var key = e.keyCode;    if ((key >= 48 && key <= 57) || (key >= 33 && key <= 47) || (key >= 58 && key <= 64) || (key >= 91 && key <= 96) || (key >= 123 && key <= 127)) {        e.preventDefault();    }    /*if (e.which === 32)        return false; */    //var text = $(this).val();    //$(this).val(text.replace(" ", ""));});是輸入<input type="text" name="name" class="form-control inputonlytext" maxlength="50" required="required"><input type="text" name="surname" class="form-control inputonlytext" maxlength="50" required="required">是PHP;if($_POST["name"] !== null && preg_match('/^[a-zA-Z ]+$/', $_POST["name"]) && $_POST["surname"] !== null && preg_match('/^[a-zA-Z ]+$/', $_POST["surname"])){            //true for my application logic. (think like a reverse)}else{            //false for my application logic. (think like a reverse)}
查看完整描述

1 回答

?
守著星空守著你

TA貢獻1799條經驗 獲得超8個贊

這是另一種選擇;

我用了

$_POST["name"] !== null

代替

isset($_POST["name"])


查看完整回答
反對 回復 2023-03-04
  • 1 回答
  • 0 關注
  • 119 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號