我知道有很多相同的问题,但仍然找不到修复错误的方法。请参阅图片了解更多详情。我使用了Xcode 7和swift 2.0
编辑:搞砸Swift的警告。 finnaly <?php
include "config.php";
extract($_POST);
$file_exts = array("jpg", "bmp", "jpeg", "gif", "png");
$upload_exts = end(explode(".", $_FILES["img"]["name"]));
if ((($_FILES["img"]["type"] == "img/gif")
|| ($_FILES["img"]["type"] == "img/jpeg")
|| ($_FILES["img"]["type"] == "img/png")
|| ($_FILES["img"]["type"] == "img/pjpeg"))
&& ($_FILES["img"]["size"] < 2000000)
&& in_array($upload_exts, $file_exts))
{
if ($_FILES["img"]["error"] > 0)
{
header("Location: Add_Decoration_Item_form.php?err=imgpro1");
//echo "Return Code: " . $_FILES["img"]["error"] . "<br>";
}
else
{
$tempupname = time().$_FILES["img"]["name"];
$imgpathtostore="imgs/".$tempupname;
$imgpathtostoreDB="imgs/".$tempupname;
// Enter your path to upload file here
move_uploaded_file($_FILES["img"]["tmp_name"], $imgpathtostore);
$sql= "INSERT INTO user_regi.u_reg (u_id, u_name, u_gender, u_mail, u_pwd, u_dob,u_hobbies,u_image,u_about) VALUES (NULL, '$uname', '$gender', '$email', '$pwd', '$DOB',$team, $img,'$about')";
mysqli_query($con,$sql);
if(mysqli_errno($con))
{
echo mysqli_errno();
/*header("Location: Form.php?msg=err");*/
}
else
{
header("Location: Form.php?msg=ok");
}
}
}
else
{
header("Location: Form.php?err=imgpro");
}
?>
修正了错误
答案 0 :(得分:6)
change
是可选的。打开可选的
let isCaptureStillImage = change![NSKeyValueChangeNewKey]!.boolValue
或使用可选绑定
if let changeNewKey = change?[NSKeyValueChangeNewKey] {
let isCaptureStillImage = changeNewKey.boolValue
...