Php feof()要求参数1是资源,在
我试图制作一个散列标识符,我对php不太在行,但我可以做一些简单的事情,我不断在我的错误日志中重复这两个错误Php feof()要求参数1是资源,在,php,python,html,Php,Python,Html,我试图制作一个散列标识符,我对php不太在行,但我可以做一些简单的事情,我不断在我的错误日志中重复这两个错误 feof() expects parameter 1 to be resource, null given in *** on line 48 fread() expects parameter 1 to be resource, null given in *** on line 50 这是我的剧本 <html xmlns="http://www.w3.org/1999
feof() expects parameter 1 to be resource, null given in *** on line 48
fread() expects parameter 1 to be resource, null given in *** on line 50
这是我的剧本
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Online Hash Identifier</title>
<style type='text/css'>
body{
background:#000;
color: #7FFF00;
font-family:'Lucida Console',sans-serif !important;
font-size: 12px;
}
fieldset {
border: 0;
}
</style>
<body>
<form method="post" action="hash.php" name="checkcodes" id="checkcodes">
<fieldset>
<label for="username">Enter Hash to identify : </label><input type="text" name="code" id="code" />
<input type="submit" name="register" id="register" value="Submit" required />
</fieldset>
<?php
if(!empty($_POST['code']))
{
$param1 = $_POST['code'];
$param1 = str_replace(' ', '',$param1);
$filter = '!^[\w @.-]*$!';
$b64pram = base64_encode($param1);
$command = "python Hash_ID_v1.1.py";
$command .= " $b64pram 2>&1";
header('Content-Type: text/html; charset=utf-8');
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
echo " <button ONCLICK='history.go(-1)'>Back</button><br />";
$pid = popen( $command,"r");
echo "<body><pre>";
while( !feof( $pid ) )
{
echo fread($pid, 256);
flush();
ob_flush();
echo "<script>window.scrollTo(0,99999);</script>";
usleep(100000);
}
pclose($pid);
echo "</pre><script>window.scrollTo(0,99999);</script>";
}
?>
有人知道为什么它不起作用吗 在我看来,popen正在返回null为什么这个标记为python?@abarnert是因为$command=python Hash\u ID\u v1.1.py;或者这是不相关的?@abarnert如果你觉得我犯了一个错误,那么如果你认为它与Python无关,那么一定要删除标记。