Php 一个变量的多个字符串
我正在尝试创建一个允许通过管理员ID授权交易的系统。我希望有多个管理员ID,以跟踪哪个用户进行了交易Php 一个变量的多个字符串,php,html,mysql,Php,Html,Mysql,我正在尝试创建一个允许通过管理员ID授权交易的系统。我希望有多个管理员ID,以跟踪哪个用户进行了交易 $txtKnownAdminHash = "c0b71d437b9138ce3c1860b09b8923ebed6f8aeb3db4093458f38300f6f24eaa"; $txtHashedAdminID = hash('sha256', $txtAdminID); if ($txtKnownAdminHash != $txtHashedAdminID) { 我想允许$
$txtKnownAdminHash = "c0b71d437b9138ce3c1860b09b8923ebed6f8aeb3db4093458f38300f6f24eaa";
$txtHashedAdminID = hash('sha256', $txtAdminID);
if ($txtKnownAdminHash != $txtHashedAdminID) {
我想允许$txtnownadminhash有多个值,然后进行检查
提前感谢您的帮助您可以将所有管理员ID存储在一个数组中
$txtKnownAdminHash = array("hash1", "hash2", "hash3", "hash4");
要检查$txtHashedAdminID
是否在数组中,可以使用in_array()
。
这将检查$txtHashedAdminID
是否在$txtKnownAdminHash
数组中:
<?php
if (in_array($txtHashedAdminID, $txtKnownAdminHash)) {
// the hash is in the array
} else {
// the hash is not in the array
}
?>
阅读更多关于:
- PHP
:array()
- PHP
:在数组中()