Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 一个变量的多个字符串_Php_Html_Mysql - Fatal编程技术网

Php 一个变量的多个字符串

Php 一个变量的多个字符串,php,html,mysql,Php,Html,Mysql,我正在尝试创建一个允许通过管理员ID授权交易的系统。我希望有多个管理员ID,以跟踪哪个用户进行了交易 $txtKnownAdminHash = "c0b71d437b9138ce3c1860b09b8923ebed6f8aeb3db4093458f38300f6f24eaa"; $txtHashedAdminID = hash('sha256', $txtAdminID); if ($txtKnownAdminHash != $txtHashedAdminID) { 我想允许$

我正在尝试创建一个允许通过管理员ID授权交易的系统。我希望有多个管理员ID,以跟踪哪个用户进行了交易

$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
    在数组中()