我正在尝试使用包含要在 oracle sql 查询中使用的 windowspc 名称列表的 ini 文件。
我能够检索 ini 中的值,但是当我尝试在查询中使用该值时,我得到通知:第 22 行的 C:\xampp\htdocs\MachineJob.php 中的数组到字符串转换
当我将查询包含在 while 请求中时,我在第 16 行收到警告:C:\xampp\htdocs\MachineJob.php 中的非法字符串偏移 'WINDOWS'
警告:第 16 A 行 C:\xampp\htdocs\MachineJob.php 中的非法字符串偏移 'MACHINE2'
<?php
include 'oracon.php';
$i =1;
$win = parse_ini_file('machines.ini',true);
while($i <= 27){
echo $win['WINDOWS']['MACHINE'.$i] ;
$i++;
}
$query1 = ('select * from v$session where terminal = :win');
$result1 = oci_parse($conn, $query1);
oci_bind_by_name($result1, ':win', $win);
oci_execute($result1);
$query2 = oci_parse($conn, 'select m.machinename, j.workorderid, j.qtytoproduce, startdate, j.progressreport from job j, machine m where j.status <>600 and j.machineid = m.machineid');
oci_execute($query2);
$row1 = oci_fetch_array($result1);
echo "<table>
<tr class=\"TableHeading-CSS\">
<th class=\"TableHeading-CSS\">Machine Name</th>
<th class=\"TableHeading-CSS\">Workorder</th>
<th class=\"TableHeading-CSS\">QTY</th>
<th class=\"TableHeading-CSS\">Started</th>
<th class=\"TableHeading-CSS\">Progress</th>
<th class=\"TableHeading-CSS\">Operator</th>
</tr>";
while($row2 = oci_fetch_array($query2)){
echo "<tr class=\"Table-CSS\">";
echo "<td class=\"Table-CSS\">" . $row2['MACHINENAME'] . "</td>";
echo "<td class=\"Table-CSS\">" . $row2['WORKORDERID'] . "</td>";
echo "<td class=\"Table-CSS\">" . $row2['QTYTOPRODUCE'] . "</td>";
echo "<td class=\"Table-CSS\">" . $row2['STARTDATE'] . "</td>";
echo "<td class=\"Table-CSS\">" . $row2['PROGRESSREPORT'] . "</td>";
echo "<td class=\"Table-CSS\">" . $row1['USERNAME'] . "</td>";
echo "</tr>";}
echo "</table>";
?>
机器ini内容
[WINDOWS]
MACHINE1 = FHMTESTDC01-JMS
MACHINE2 = FHMDC0002-JMS
MACHINE3 = FHMDC0003-JMS
MACHINE29 =FHMDC0029-JMS
[DBNAME]
MACHINE1 = TESTDC01
MACHINE2 = DC9k02
MACHINE3 = DC9k03
etc