简体   繁体   English

PHP注意:php文件中的数组到字符串的转换

[英]PHP Notice: Array to string conversion in php file

Need your help again. 再次需要您的帮助。

Basically I would like to get a confirmation dialog if you would like to update records. 基本上,如果您想更新记录,我想获得一个确认对话框。 If yes, call php function update_SQL to update them. 如果是,请调用php函数update_SQL进行更新。 I've written following piece of code in php: 我已经在php中编写了以下代码:

echo "<script type='text/javascript'>
        if(confirm('Records will be updated. Continue? ')) {
                <?php update_SQL($array); ?> //call php function here
        } else {
                return; //exit out of the file
        }
</script>";

function update_SQL($array) { //update records
}

The problem is as all records are in array, when I call the update_SQL function, it gives me following error: 问题是因为所有记录都在数组中,当我调用update_SQL函数时,它给了我以下错误:

FastCGI sent in stderr: "PHP message: PHP Notice: Array to string conversion in (FILENAME.php) on line" while reading response header from upstream FastCGI在stderr中发送:“ PHP消息:PHP注意:在线上(FILENAME.php)中的数组到字符串的转换”,同时从上游读取响应头

Can you please help?? 你能帮忙吗?

Thanks in advance 提前致谢

Not sure why the previous person deleted his answer. 不知道为什么以前的人删除了他的答案。 He was correct. 他是正确的。

The answer was to use it as following 答案是按以下方式使用它

echo "<script type='text/javascript'>
        if(confirm('Records will be updated. Continue? ')) {
                ".update_SQL($array)."
        } else {
                die;
        }
</script>";

function update_SQL($array) {
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM