php 空白 无提示框,PHP空白页面,没有错误

一个PHP页面在本地运行正常,但在上传到服务器后出现空白屏幕问题。尽管设置了错误报告,但仍然无法获取任何错误信息。代码检查了用户输入的姓名、电话、邮箱和图片,进行了错误处理和数据库连接。当所有字段都填写正确时,数据会被插入数据库。目前,服务器上的页面只显示空白,可能是由于服务器配置、文件权限或错误处理设置导致。
摘要由CSDN通过智能技术生成

我有一个

PHP页面,我在本地开发并且工作正常.将它上传到服务器后,我现在只得到一个空白的白色屏幕?它是完全相同的代码,在本地工作正常但不远程.我已尝试设置错误报告,但仍然没有给我任何错误,只是一个空白的白色屏幕.

编辑———-代码:

$firstname = $phone = $email = $picture = $sqlcon = "";

$firstnameErr = $phoneErr = $emailErr = $pictureErr = $sqlErr = $filterErr = "";

$statusmsg = "";

$newpicture = $registered = "false";

if ($_SERVER["REQUEST_METHOD"] == "POST") {

// If the user has not entered a firstname and has not entered details previously

if ((empty($_POST["firstname"])) && empty($_POST["hfirst"])) {

$firstnameErr = "Firstname is required for submission";

}

else {

if (!empty($_POST["firstname"])) {

$firstname = $_POST["firstname"];

}

else {

$firstname = $_POST["hfirst"];

}

if (!preg_match("/^[a-zA-Z ]*$/", $firstname)) {

$firstnameErr="Please ensure you have entered only characters for your first name";

}

}

// If the user has not entered a phone number and has not entered details previously

if ((empty($_POST["phone"])) && (empty($_POST["hphone"]))) {

$phoneErr = "Please ensure you have entered a phone number";

}

else {

if (!empty($_POST["phone"])) {

$phone = $_POST["phone"];

}

else {

$phone = $_POST["hphone"];

}

if (!is_numeric($phone)) {

$phoneErr = "Please ensure you have entered a valid phone number";

}

}

if ((empty($_POST["email"])) && (empty($_POST["hemail"]))) {

$emailErr = "Please ensure you have entered your email address";

}

else {

if (!empty($_POST["email"])) {

$email = $_POST["email"];

}

else {

$email = $_POST["hemail"];

}

if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) {

$emailErr = "Please ensure you have entered a valid email address";

}

}

if ((empty($_FILES["file"]["name"])) && (empty($_POST["hfile"]))) {

$pictureErr = "Please ensure you have selected a picture to upload";

}

else {

if (!empty($_FILES["file"]["name"])) {

if ($_FILES["file"]["size"] > 1048576) {

$pictureErr = "The maximum size for a picture is 1mb";

}

else {

// Ensure the user has selected a file of accepted type

$temp = explode(".", $_FILES["file"]["name"]);

$ext = end($temp);

$allowedExt = array ("gif", "JPEG", "jpg", "png", "JPG");

if (!in_array($ext, $allowedExt)) {

$pictureErr = "Please ensure you have uploaded an image file";

}

}

$newpicture = "true";

$picture = $_FILES["file"]["name"];

}

else {

$picture = $_POST["hpicture"];

}

}

$sqlcon = mysqli_connect("localhost", "USER", "PASS", "personneldb");

if (mysqli_connect_errno()) {

$sqlErr = "Could not connect to database";

mysqli_close($sqlcon);

}

if ($newpicture == "true") {

if (!move_uploaded_file($_FILES["file"]["tmp_name"], "./upload/".$_FILES["file"]["name"])) {

$pictureErr = "File could not be uploaded";

}

}

if ((empty($firstnameErr)) && (empty($emailErr)) && (empty($phoneErr)) && (empty($pictureErr == "")) && (empty($sqlErr == ""))) {

mysqli_query($sqlcon, "INSERT INTO test2Details(Firstname, Phone, Email, ImageName)

VALUES ('$firstname', '$phone', '$email', '$picture')");

// Display status message

$statusmsg = "Success! Your details and picture have been uploaded and stored";

}

if ((!empty($firstname)) && (!empty($phone)) && (!empty($email)) && (!empty($picture))) {

$registered = "true";

}

else {

$registered = "false";

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值