PHP设计超级好用的文件上传处置类一 (37)
PHP设计超级好用的文件上传处理类一 (37)
<span style="color: #000000;">php </span><span style="color: #0000ff;">class</span><span style="color: #000000;"> FileUpload { </span><span style="color: #0000ff;">private</span> $filepath; <span style="color: #008000;">//</span><span style="color: #008000;">指定上传文件保存的路径</span> <span style="color: #0000ff;">private</span> $allowtype=array(<span style="color: #800000;">'</span><span style="color: #800000;">gif</span><span style="color: #800000;">'</span>, <span style="color: #800000;">'</span><span style="color: #800000;">jpg</span><span style="color: #800000;">'</span>, <span style="color: #800000;">'</span><span style="color: #800000;">png</span><span style="color: #800000;">'</span>, <span style="color: #800000;">'</span><span style="color: #800000;">jpeg</span><span style="color: #800000;">'</span>); <span style="color: #008000;">//</span><span style="color: #008000;">充许上传文件的类型</span> <span style="color: #0000ff;">private</span> $maxsize=<span style="color: #800080;">1000000</span>; <span style="color: #008000;">//</span><span style="color: #008000;">允上传文件的最大长度 1M</span> <span style="color: #0000ff;">private</span> $israndname=<span style="color: #0000ff;">true</span>; <span style="color: #008000;">//</span><span style="color: #008000;">是否随机重命名, true false不随机,使用原文件名</span> <span style="color: #0000ff;">private</span> $originName; <span style="color: #008000;">//</span><span style="color: #008000;">源文件名称</span> <span style="color: #0000ff;">private</span> $tmpFileName; <span style="color: #008000;">//</span><span style="color: #008000;">临时文件名</span> <span style="color: #0000ff;">private</span> $fileType; <span style="color: #008000;">//</span><span style="color: #008000;">文件类型</span> <span style="color: #0000ff;">private</span> $fileSize; <span style="color: #008000;">//</span><span style="color: #008000;">文件大小</span> <span style="color: #0000ff;">private</span> $newFileName; <span style="color: #008000;">//</span><span style="color: #008000;">新文件名</span> <span style="color: #0000ff;">private</span> $errorNum=<span style="color: #800080;">0</span>; <span style="color: #008000;">//</span><span style="color: #008000;">错误号</span> <span style="color: #0000ff;">private</span> $errorMess=<span style="color: #800000;">""</span>; <span style="color: #008000;">//</span><span style="color: #008000;">用来提供错误报告 </span><span style="color: #008000;">//</span><span style="color: #008000;">用于对上传文件初使化 </span><span style="color: #008000;">//</span><span style="color: #008000;">1. 指定上传路径, 2,充许的类型, 3,限制大小, 4,是否使用随机文件名称 </span><span style="color: #008000;">//</span><span style="color: #008000;">让用户可以不用按位置传参数,后面参数给值不用将前几个参数也提供值</span> function __construct($options=<span style="color: #000000;">array()){ </span><span style="color: #0000ff;">foreach</span>($options <span style="color: #0000ff;">as</span> $key=><span style="color: #000000;">$val){ $key</span>=<span style="color: #000000;">strtolower($key); </span><span style="color: #008000;">//</span><span style="color: #008000;">查看用户参数中数组的下标是否和成员属性名相同</span> <span style="color: #0000ff;">if</span>(!in_array($key,get_class_vars(get_class($<span style="color: #0000ff;">this</span><span style="color: #000000;">)))){ </span><span style="color: #0000ff;">continue</span><span style="color: #000000;">; } $</span><span style="color: #0000ff;">this</span>-><span style="color: #000000;">setOption($key, $val); } } </span><span style="color: #0000ff;">private</span><span style="color: #000000;"> function getError(){ $str</span>=<span style="color: #800000;">"</span><span style="color: #800000;">上传文件<font color="red">{$this->originName}</font>时出错:</span><span style="color: #800000;">"</span><span style="color: #000000;">; </span><span style="color: #0000ff;">switch</span>($<span style="color: #0000ff;">this</span>-><span style="color: #000000;">errorNum){ </span><span style="color: #0000ff;">case</span> <span style="color: #800080;">4</span>: $str .= <span style="color: #800000;">"</span><span style="color: #800000;">没有文件被上传</span><span style="color: #800000;">"</span>; <span style="color: #0000ff;">break</span><span style="color: #000000;">; </span><span style="color: #0000ff;">case</span> <span style="color: #800080;">3</span>: $str .= <span style="color: #800000;">"</span><span style="color: #800000;">文件只被部分上传</span><span style="color: #800000;">"</span>; <span style="color: #0000ff;">break</span><span style="color: #000000;">; </span><span style="color: #0000ff;">case</span> <span style="color: #800080;">2</span>: $str .= <span style="color: #800000;">"</span><span style="color: #800000;">上传文件超过了HTML表单中MAX_FILE_SIZE选项指定的值</span><span style="color: #800000;">"</span>; <span style="color: #0000ff;">break</span><span style="color: #000000;">; </span><span style="color: #0000ff;">case</span> <span style="color: #800080;">1</span>: $str .= <span style="color: #800000;">"</span><span style="color: #800000;">上传文件超过了php.ini 中upload_max_filesize选项的值</span><span style="color: #800000;">"</span>; <span style="color: #0000ff;">break</span><span style="color: #000000;">; </span><span style="color: #0000ff;">case</span> -<span style="color: #800080;">1</span>: $str .= <span style="color: #800000;">"</span><span style="color: #800000;">末充许的类型</span><span style="color: #800000;">"</span>; <span style="color: #0000ff;">break</span><span style="color: #000000;">; </span><span style="color: #0000ff;">case</span> -<span style="color: #800080;">2</span>: $str .= <span style="color: #800000;">"</span><span style="color: #800000;">文件过大,上传文件不能超过{$this->maxSize}个字节</span><span style="color: #800000;">"</span>; <span style="color: #0000ff;">break</span><span style="color: #000000;">; </span><span style="color: #0000ff;">case</span> -<span style="color: #800080;">3</span>: $str .= <span style="color: #800000;">"</span><span style="color: #800000;">上传失败</span><span style="color: #800000;">"</span>; <span style="color: #0000ff;">break</span><span style="color: #000000;">; </span><span style="color: #0000ff;">case</span> -<span style="color: #800080;">4</span>: $str .= <span style="color: #800000;">"</span><span style="color: #800000;">建立存放上传文件目录失败,请重新指定上传目录</span><span style="color: #800000;">"</span>; <span style="color: #0000ff;">break</span><span style="color: #000000;">; </span><span style="color: #0000ff;">case</span> -<span style="color: #800080;">5</span>: $str .= <span style="color: #800000;">"</span><span style="color: #800000;">必须指定上传文件的路径</span><span style="color: #800000;">"</span>; <span style="color: #0000ff;">break</span><span style="color: #000000;">; </span><span style="color: #0000ff;">default</span>: $str .= <span style="color: #800000;">"</span><span style="color: #800000;">末知错误</span><span style="color: #800000;">"</span><span style="color: #000000;">; } </span><span style="color: #0000ff;">return</span> $str.<span style="color: #800000;">'</span><span style="color: #800000;"><br></span><span style="color: #800000;">'</span><span style="color: #000000;">; } </span><span style="color: #008000;">//</span><span style="color: #008000;">用来检查文件上传路径</span> <span style="color: #0000ff;">private</span><span style="color: #000000;"> function checkFilePath(){ </span><span style="color: #0000ff;">if</span>(empty($<span style="color: #0000ff;">this</span>-><span style="color: #000000;">filepath)) { $</span><span style="color: #0000ff;">this</span>->setOption(<span style="color: #800000;">'</span><span style="color: #800000;">errorNum</span><span style="color: #800000;">'</span>, -<span style="color: #800080;">5</span><span style="color: #000000;">); </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">; } </span><span style="color: #0000ff;">if</span>(!file_exists($<span style="color: #0000ff;">this</span>->filepath) || !is_writable($<span style="color: #0000ff;">this</span>-><span style="color: #000000;">filepath)){ </span><span style="color: #0000ff;">if</span>([email protected]($<span style="color: #0000ff;">this</span>->filepath, <span style="color: #800080;">0755</span><span style="color: #000000;">)){ $</span><span style="color: #0000ff;">this</span>->setOption(<span style="color: #800000;">'</span><span style="color: #800000;">errorNum</span><span style="color: #800000;">'</span>, -<span style="color: #800080;">4</span><span style="color: #000000;">); </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">; } } </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #000000;">; } </span><span style="color: #008000;">//</span><span style="color: #008000;">用来检查文件上传的大小</span> <span style="color: #0000ff;">private</span><span style="color: #000000;"> function checkFileSize() { </span><span style="color: #0000ff;">if</span>($<span style="color: #0000ff;">this</span>->fileSize > $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">maxsize){ $</span><span style="color: #0000ff;">this</span>->setOPtion(<span style="color: #800000;">'</span><span style="color: #800000;">errorNum</span><span style="color: #800000;">'</span>, <span style="color: #800000;">'</span><span style="color: #800000;">-2</span><span style="color: #800000;">'</span><span style="color: #000000;">); </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">; }</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{ </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #000000;">; } } </span><span style="color: #008000;">//</span><span style="color: #008000;">用于检查文件上传类型</span> <span style="color: #0000ff;">private</span><span style="color: #000000;"> function checkFileType() { </span><span style="color: #0000ff;">if</span>(in_array(strtolower($<span style="color: #0000ff;">this</span>->fileType), $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">allowtype)) { </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #000000;">; }</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{ $</span><span style="color: #0000ff;">this</span>->setOption(<span style="color: #800000;">'</span><span style="color: #800000;">errorNum</span><span style="color: #800000;">'</span>, -<span style="color: #800080;">1</span><span style="color: #000000;">); </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">; } } </span><span style="color: #008000;">//</span><span style="color: #008000;">设置上传后的文件名称</span> <span style="color: #0000ff;">private</span><span style="color: #000000;"> function setNewFileName(){ </span><span style="color: #0000ff;">if</span>($<span style="color: #0000ff;">this</span>-><span style="color: #000000;">israndname){ $</span><span style="color: #0000ff;">this</span>->setOption(<span style="color: #800000;">'</span><span style="color: #800000;">newFileName</span><span style="color: #800000;">'</span>, $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">proRandName()); } </span><span style="color: #0000ff;">else</span><span style="color: #000000;"> { $</span><span style="color: #0000ff;">this</span>->setOption(<span style="color: #800000;">'</span><span style="color: #800000;">newFileName</span><span style="color: #800000;">'</span>, $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">originName); } } </span><span style="color: #008000;">//</span><span style="color: #008000;">设置随机文件名称</span> <span style="color: #0000ff;">private</span><span style="color: #000000;"> function proRandName(){ $fileName</span>=date(<span style="color: #800000;">"</span><span style="color: #800000;">YmdHis</span><span style="color: #800000;">"</span>).rand(<span style="color: #800080;">100</span>,<span style="color: #800080;">999</span><span style="color: #000000;">); </span><span style="color: #0000ff;">return</span> $fileName.<span style="color: #800000;">'</span><span style="color: #800000;">.</span><span style="color: #800000;">'</span>.$<span style="color: #0000ff;">this</span>-><span style="color: #000000;">fileType; } </span><span style="color: #0000ff;">private</span><span style="color: #000000;"> function setOption($key, $val){ $</span><span style="color: #0000ff;">this</span>->$key=<span style="color: #000000;">$val; } </span><span style="color: #008000;">//</span><span style="color: #008000;">用来上传一个文件</span><span style="color: #000000;"> function uploadFile($fileField){ $</span><span style="color: #0000ff;">return</span>=<span style="color: #0000ff;">true</span><span style="color: #000000;">; </span><span style="color: #008000;">//</span><span style="color: #008000;">检查文件上传路径</span> <span style="color: #0000ff;">if</span>(!$<span style="color: #0000ff;">this</span>-><span style="color: #000000;">checkFilePath()){ $</span><span style="color: #0000ff;">this</span>->errorMess=$<span style="color: #0000ff;">this</span>-><span style="color: #000000;">getError(); </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">; } $name</span>=$_FILES[$fileField][<span style="color: #800000;">'</span><span style="color: #800000;">name</span><span style="color: #800000;">'</span><span style="color: #000000;">]; $tmp_name</span>=$_FILES[$fileField][<span style="color: #800000;">'</span><span style="color: #800000;">tmp_name</span><span style="color: #800000;">'</span><span style="color: #000000;">]; $size</span>=$_FILES[$fileField][<span style="color: #800000;">'</span><span style="color: #800000;">size</span><span style="color: #800000;">'</span><span style="color: #000000;">]; $error</span>=$_FILES[$fileField][<span style="color: #800000;">'</span><span style="color: #800000;">error</span><span style="color: #800000;">'</span><span style="color: #000000;">]; </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(is_Array($name)){ $errors</span>=<span style="color: #000000;">array(); </span><span style="color: #0000ff;">for</span>($i=<span style="color: #800080;">0</span>; $i<count style="color: #000000;">){ <span style="color: #0000ff;">if</span>($<span style="color: #0000ff;">this</span>-><span style="color: #000000;">setFiles($name[$i], $tmp_name[$i], $size[$i], $error[$i])){ </span><span style="color: #0000ff;">if</span>(!$<span style="color: #0000ff;">this</span>->checkFileSize() || !$<span style="color: #0000ff;">this</span>-><span style="color: #000000;">checkFileType()){ $errors[]</span>=$<span style="color: #0000ff;">this</span>-><span style="color: #000000;">getError(); $</span><span style="color: #0000ff;">return</span>=<span style="color: #0000ff;">false</span><span style="color: #000000;">; } }</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{ $error[]</span>=$<span style="color: #0000ff;">this</span>-><span style="color: #000000;">getError(); $</span><span style="color: #0000ff;">return</span>=<span style="color: #0000ff;">false</span><span style="color: #000000;">; } </span><span style="color: #0000ff;">if</span>(!$<span style="color: #0000ff;">return</span><span style="color: #000000;">) $</span><span style="color: #0000ff;">this</span>-><span style="color: #000000;">setFiles(); } </span><span style="color: #0000ff;">if</span>($<span style="color: #0000ff;">return</span><span style="color: #000000;">){ $fileNames</span>=<span style="color: #000000;">array(); </span><span style="color: #0000ff;">for</span>($i=<span style="color: #800080;">0</span>; $i<count style="color: #000000;">){ <span style="color: #0000ff;">if</span>($<span style="color: #0000ff;">this</span>-><span style="color: #000000;">setFiles($name[$i], $tmp_name[$i], $size[$i], $error[$i])){ $</span><span style="color: #0000ff;">this</span>-><span style="color: #000000;">setNewFileName(); </span><span style="color: #0000ff;">if</span>(!$<span style="color: #0000ff;">this</span>-><span style="color: #000000;">copyFile()){ $errors</span>=$<span style="color: #0000ff;">this</span>-><span style="color: #000000;">getError(); $</span><span style="color: #0000ff;">return</span>=<span style="color: #0000ff;">false</span><span style="color: #000000;">; }</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{ $fileNames[]</span>=$<span style="color: #0000ff;">this</span>-><span style="color: #000000;">newFileName; } } } $</span><span style="color: #0000ff;">this</span>->newFileName=<span style="color: #000000;">$fileNames; } $</span><span style="color: #0000ff;">this</span>->errorMess=<span style="color: #000000;">$errors; </span><span style="color: #0000ff;">return</span> $<span style="color: #0000ff;">return</span><span style="color: #000000;">; } </span><span style="color: #0000ff;">else</span><span style="color: #000000;"> { </span><span style="color: #0000ff;">if</span>($<span style="color: #0000ff;">this</span>-><span style="color: #000000;">setFiles($name, $tmp_name, $size, $error)){ </span><span style="color: #0000ff;">if</span>($<span style="color: #0000ff;">this</span>->checkFileSize() && $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">checkFileType()){ $</span><span style="color: #0000ff;">this</span>-><span style="color: #000000;">setNewFileName(); </span><span style="color: #0000ff;">if</span>($<span style="color: #0000ff;">this</span>-><span style="color: #000000;">copyFile()){ </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #000000;">; }</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{ $</span><span style="color: #0000ff;">return</span>=<span style="color: #0000ff;">false</span><span style="color: #000000;">; } }</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{ $</span><span style="color: #0000ff;">return</span>=<span style="color: #0000ff;">false</span><span style="color: #000000;">; } }</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{ $</span><span style="color: #0000ff;">return</span>=<span style="color: #0000ff;">false</span><span style="color: #000000;">; } </span><span style="color: #0000ff;">if</span>(!$<span style="color: #0000ff;">return</span><span style="color: #000000;">) $</span><span style="color: #0000ff;">this</span>->errorMess=$<span style="color: #0000ff;">this</span>-><span style="color: #000000;">getError(); </span><span style="color: #0000ff;">return</span> $<span style="color: #0000ff;">return</span><span style="color: #000000;">; } } </span><span style="color: #0000ff;">private</span><span style="color: #000000;"> function copyFile(){ </span><span style="color: #0000ff;">if</span>(!$<span style="color: #0000ff;">this</span>-><span style="color: #000000;">errorNum){ $filepath</span>=rtrim($<span style="color: #0000ff;">this</span>->filepath, <span style="color: #800000;">'</span><span style="color: #800000;">/</span><span style="color: #800000;">'</span>).<span style="color: #800000;">'</span><span style="color: #800000;">/</span><span style="color: #800000;">'</span><span style="color: #000000;">; $filepath.</span>=$<span style="color: #0000ff;">this</span>-><span style="color: #000000;">newFileName; </span><span style="color: #0000ff;">if</span>(@move_uploaded_file($<span style="color: #0000ff;">this</span>-><span style="color: #000000;">tmpFileName, $filepath)) { </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #000000;">; }</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{ $</span><span style="color: #0000ff;">this</span>->setOption(<span style="color: #800000;">'</span><span style="color: #800000;">errorNum</span><span style="color: #800000;">'</span>, -<span style="color: #800080;">3</span><span style="color: #000000;">); </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">; } }</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{ </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">; } } </span><span style="color: #008000;">//</span><span style="color: #008000;">设置和$_FILES有关的内容</span> <span style="color: #0000ff;">private</span> function setFiles($name=<span style="color: #800000;">""</span>, $tmp_name=<span style="color: #800000;">''</span>, $size=<span style="color: #800080;">0</span>, $error=<span style="color: #800080;">0</span><span style="color: #000000;">){ $</span><span style="color: #0000ff;">this</span>->setOption(<span style="color: #800000;">'</span><span style="color: #800000;">errorNum</span><span style="color: #800000;">'</span><span style="color: #000000;">, $error); </span><span style="color: #0000ff;">if</span><span style="color: #000000;">($error){ </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #000000;">; } $</span><span style="color: #0000ff;">this</span>->setOption(<span style="color: #800000;">'</span><span style="color: #800000;">originName</span><span style="color: #800000;">'</span><span style="color: #000000;">, $name); $</span><span style="color: #0000ff;">this</span>->setOption(<span style="color: #800000;">'</span><span style="color: #800000;">tmpFileName</span><span style="color: #800000;">'</span><span style="color: #000000;">, $tmp_name); $arrStr</span>=explode(<span style="color: #800000;">'</span><span style="color: #800000;">.</span><span style="color: #800000;">'</span><span style="color: #000000;">, $name); $</span><span style="color: #0000ff;">this</span>->setOption(<span style="color: #800000;">'</span><span style="color: #800000;">fileType</span><span style="color: #800000;">'</span>, strtolower($arrStr[count($arrStr)-<span style="color: #800080;">1</span><span style="color: #000000;">])); $</span><span style="color: #0000ff;">this</span>->setOption(<span style="color: #800000;">'</span><span style="color: #800000;">fileSize</span><span style="color: #800000;">'</span><span style="color: #000000;">, $size); </span><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #000000;">; } </span><span style="color: #008000;">//</span><span style="color: #008000;">用于获取上传后文件的文件名</span><span style="color: #000000;"> function getNewFileName(){ </span><span style="color: #0000ff;">return</span> $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">newFileName; } </span><span style="color: #008000;">//</span><span style="color: #008000;">上传如果失败,则调用这个方法,就可以查看错误报告</span><span style="color: #000000;"> function getErrorMsg() { </span><span style="color: #0000ff;">return</span> $<span style="color: #0000ff;">this</span>-><span style="color: #000000;">errorMess; } }</span></count></count>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

The usage of return in C language is: 1. For functions whose return value type is void, you can use the return statement to end the execution of the function early; 2. For functions whose return value type is not void, the function of the return statement is to end the execution of the function. The result is returned to the caller; 3. End the execution of the function early. Inside the function, we can use the return statement to end the execution of the function early, even if the function does not return a value.

Why Snipping Tool Not Working on Windows 11 Understanding the root cause of the problem can help find the right solution. Here are the top reasons why the Snipping Tool might not be working properly: Focus Assistant is On: This prevents the Snipping Tool from opening. Corrupted application: If the snipping tool crashes on launch, it might be corrupted. Outdated graphics drivers: Incompatible drivers may interfere with the snipping tool. Interference from other applications: Other running applications may conflict with the Snipping Tool. Certificate has expired: An error during the upgrade process may cause this issu simple solution. These are suitable for most users and do not require any special technical knowledge. 1. Update Windows and Microsoft Store apps

Source code: publicclassReturnFinallyDemo{publicstaticvoidmain(String[]args){System.out.println(case1());}publicstaticintcase1(){intx;try{x=1;returnx;}finally{x=3;}}}#Output The output of the above code can simply conclude: return is executed before finally. Let's take a look at what happens at the bytecode level. The following intercepts part of the bytecode of the case1 method, and compares the source code to annotate the meaning of each instruction in

In Java, private means "private" and is an access control modifier used to modify classes, properties and methods. Class members modified with private can only be accessed and modified by the methods of the class itself, and cannot be accessed and referenced by any other class (including subclasses of the class); therefore, the private modifier has the highest level of protection.

Part 1: Initial Troubleshooting Steps Checking Apple’s System Status: Before delving into complex solutions, let’s start with the basics. The problem may not lie with your device; Apple's servers may be down. Visit Apple's System Status page to see if the AppStore is working properly. If there's a problem, all you can do is wait for Apple to fix it. Check your internet connection: Make sure you have a stable internet connection as the "Unable to connect to AppStore" issue can sometimes be attributed to a poor connection. Try switching between Wi-Fi and mobile data or resetting network settings (General > Reset > Reset Network Settings > Settings). Update your iOS version:

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

Private is a Java access modifier that limits the accessibility of a function to only the class in which it is defined, including: the function cannot be accessed in other classes. The function is also not accessible in subclasses.
