ValueError: No gradients provided for any variable: ['sequential/dense/kernel:0', 'sequential/dense/bias:0', 'sequential/dense_1/kernel:0', 'sequential/dense_1/bias:0', 'sequential/dense_2/kernel:0', 'sequential/dense_2/bias:0', 'sequential/dense_3/kernel:0', 'sequential/dense_3/bias:0'].
我在这里填写了表单,现在我尝试在输入表单时查找输入是否包含[key1] <form action="" method="post">
<?php if($input !== null){ //if input is submitted then show message
if(strpos($input, '[key1]') === true or strpos($input, 'key2') === true) { //find the input [key1] or [key2]
echo " input contain [key1] or [key2] ";
}else{ // input doesnt contain [key1] or [key2]
echo " input didnt contain [key1] or [key2]";
}
}else{ // showing form input
echo "
<input type='text' name='inputText' maxlength='100' data-length=100 class='form-control char-textarea' rows='3' placeholder='use [key1] or [key2]' required aria-invalid='false'/>
<input type='file' name='fileToUpload' id='fileToUpload' ><br>
<button type='submit' name='SubmitButton' class='btn btn-primary mr-1 mb-1'>Send</button>
";
}?>
</form>
[key2]
or
但是结果是if(strpos($input, '[key1]') === true or strpos($input, 'key2') === true)
而不是echo " input didnt contain [key1] or [key2]";
答案 0 :(得分:0)
strpos
返回一个整数(如果找到字符串,则返回位置),或者返回false
(如果找不到该字符串)。所以你的测试
if(strpos($input, '[key1]') === true or strpos($input, 'key2') === true)
将永远不会过去,因为整数或false
永远不会是=== true
。相反,更改测试以检查strpos
的结果是否不是false
:
if(strpos($input, '[key1]') !== false or strpos($input, 'key2') !== false)