php - PHP7中数组到字符串的转换问题
问题描述
我正在为我工作的公司建立一个技术评估系统。当我将它上传到在线主机时,出现“数组字符串转换”错误。
注意:第 4 行 /storage/ssd5/805/10576805/public_html/UI/data.php 中的数组到字符串转换 注意:未定义属性:/storage/ssd5/805/10576805/public_html/UI/ 中的 UserData::$Array第 4 行的 data.php 致命错误:未捕获的错误:函数名称必须是 /storage/ssd5/805/10576805/public_html/UI/data.php:4 中的字符串 堆栈跟踪:在 /storage/ 中抛出 #0 {main} ssd5/805/10576805/public_html/UI/data.php 在第 4 行
我试图在 PHP5 中运行该程序,直到它工作的旧版本的 PHP。但是在 PHP7 到最新版本中不起作用。我认为PHP7的数组转换有新的语法。你能帮我解决这个问题吗?非常感谢。
数据.php
<?php
$process = new UserData();
if(isset($_GET['q'])){
$process->$_GET['q'](); //this line have an error
}
class UserData {
function deletePending(){
require '../config.php';
$trans_no = $_GET['trans_no'];
$q = $connection->query("delete from tevaluation where TRANS_NO='$trans_no'");
return $q;
}
}
?>
查看.php
<html>
<head>
<title>
Technical Evaluation
</title>
</head>
<body>
<?php
include 'data.php';
$data = $process->pendingEvaluation();
?>
<table class="table table-hover" id="itemList">
<thead class="bg-primary">
<tr>
<th class="text-center" width="35">TE #</th>
<th class="text-center" width="10">QUANTITY</th>
<th class="text-center" width="10">UNIT</th>
<th class="text-center" width="20">DESCRIPTION</th>
<th class="text-center" width="20">DEPARTMENT</th>
<th class="text-center" width="130">DATE EVALUATED</th>
<th class="text-center" width="50">STATUS</th>
<th class="text-center">ACTION</th>
</tr>
</thead>
<tbody>
<?php if($data->num_rows > 0): ?>
<?php while($row = mysqli_fetch_array($data)): ?>
<?php if($row['STATUS'] == 2):
$stat = "<p class='text-danger'><b> For Approval</b></p>";
?>
<tr>
<td class="text-center" width="15"><?php echo $row['TRANS_NO']; ?></td>
<td class="text-center" width="10"><?php echo $row['QTY']; ?></td>
<td class="text-center" width="10"><?php echo $row['UNIT']; ?></td>
<td class="text-center" width="40"><?php echo $row['DESCRIP']; ?></td>
<td class="text-center" width="20"><?php echo $row['DEPT']; ?></td>
<td class="text-center" width="130"><?php echo $row['E_DATE']; ?></td>
<td class="text-center" width="50"><?php echo $stat; ?></td>
<td>
<a href="data.php?q=deletePending&trans_no=<?php echo $row['TRANS_NO']; ?>" class="btn btn-danger btn-sm" title="Click to Delete">
<span class="fa fa-trash"></span><b> Delete</b>
</a>
</td>
</tr>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
</tbody>
</table>
</body>
</html>
解决方案
推荐阅读
- django - 将 PRIMARY KEY 约束添加到现有表
- node.js - NextJS 与 ExpressJS 服务器 ENV 变量在使用前未加载
- python - 使用 folium python 提取 json 数据以绘制地图时出错
- sql - 修复存储过程pl/sql中的代码(缺少右括号)
- algorithm - 将数组划分为满足条件的相等大小的子集
- javascript - Three.js - 应用类似于 Blender 的旋转
- ios - Mapbox React Native IOS
- objective-c - NSPanel 使用 PyObjC 以 NSWindow 的样式初始化
- typescript - TypeScript Partials:如何将特定字段从一个对象映射到另一个对象
- ruby-on-rails - 应用程序遇到以下错误:在任何源 + ruby 2.5.0 + rails 6 中找不到 rake-13.0.3