如果语句变量返回空(If statement variable returning empty)

编程入门 行业动态 更新时间:2024-10-13 16:18:04
如果语句变量返回空(If statement variable returning empty)

这是我编写的测试代码,用于获取$ rectype的值集以插入表中。 我遇到的问题是$ rectype返回0或空。 文件确实存在,因为我执行类似的is_file检查以启动导致编码的这一部分的过程

$dirchk1 = "/temp/files/" . $data[0] . ".doc"; // exist $dirchk2 = "/temp/files/" . $data[1] . ".doc"; // exist $file_1 = (is_file($dirchk1)); $file_2 = (is_file($dirchk2)); if ($file_1) { $rectype == ($file_2 ? '3' : '1'); } echo $rectype . "\n";

this is a test code i wrote to get a value set for $rectype to insert into a table. problem I'm having is $rectype is returning 0 or empty. the files do exist since I perform a similar is_file check to start the process that leads up to this section of the coding

$dirchk1 = "/temp/files/" . $data[0] . ".doc"; // exist $dirchk2 = "/temp/files/" . $data[1] . ".doc"; // exist $file_1 = (is_file($dirchk1)); $file_2 = (is_file($dirchk2)); if ($file_1) { $rectype == ($file_2 ? '3' : '1'); } echo $rectype . "\n";

最满意答案

您正在使用==而不是= 。

You are using == instead of =.

更多推荐

本文发布于:2023-08-07 18:07:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465363.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:变量   语句   statement   empty   returning

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!