开发者

validate function for special characters for prescribed data in url in php , CodeIgniter

开发者 https://www.devze.com 2023-03-03 14:20 出处:网络
http://localhost/sssss/sss.php&send=90开发者_如何学Go&msg=z a data c guys i need to validate for the particular data which is in the url... validate function should be able to check for specia

http://localhost/sssss/sss.php&send=90开发者_如何学Go&msg=z a data c guys i need to validate for the particular data which is in the url... validate function should be able to check for special characters only for that data ... how to achieve this.... i need to validate in such a manner that no special characters will be in included along with the data.... and the url is how we use for recharging so spaces everything will be included


Use this:

$msg = $_GET['msg'];
list(,,,$amount,) = explode(" ", $msg);
if(preg_match("/^\\d+$/", $amount))
  echo "valid amount!";
else
  echo "invalid amount";

Hope this helps. Cheers

0

精彩评论

暂无评论...
验证码 换一张
取 消