决定将我的脚本放在/etc/crontab
而不是从浏览器中运行它,但意识到我得到了不同的结果。
从浏览器运行脚本:
Array
(
[ACTIVE] => C
[CUSTOMER_NUM] => 123
[CUSTOMER_NAME] => 123 CORP
[REPNUM] => 099
[ADDRESS1] => IDD# 123
[ADDRESS2] => P O BOX 123
[CITY] => CLEVELAND
[STATE] => OH
[ZIP] => 44136
[REPNAME] => House Account
[PHONENUM] => 123
)
从php-cli
运行脚本:
Array
(
[A] => P O BOX 123
[C] => CLEVELAND
[R] => House Account
[S] => OH
[Z] => 44136
[P] => 123
)
所以我想知道为什么关联数组键会被截断?请帮忙。感谢。
脚本:
$result = odbc_exec($db, "SELECT
CAST(F0101JC.ABAT1 as varchar(20) CCSID 37) as Active,
F0101JC.ABAN8 as CUSTOMER_NUM,
F0101JC.ABALPH as CUSTOMER_NAME,
CAST(F0101JC.ABAC02 as varchar(20) CCSID 37) as RepNum,
F0101JC.ALADD1 as Address1,
F0101JC.ALADD2 as Address2,
F0101JC.ALCTY1 as City,
CAST(F0101JC.ALADDS as varchar(20) CCSID 37) as State,
CAST(F0101JC.ALADDZ as varchar(20) CCSID 37) as Zip,
F0005.DRDL01 as RepName,
trim(CAST(F0115.WPAR1 as varchar(20) CCSID 37)) || '-' || trim(CAST(F0115.WPPH1 as varchar(20) CCSID 37)) as PhoneNum
FROM CLTPRDDTA.F0101JC \"F0101JC\"
LEFT JOIN GENCOM.F0005 \"F0005\"
ON \"F0101JC\".\"ABAC02\" = trim(\"F0005\".\"DRKY\")
LEFT JOIN CLTPRDDTA.F0115 F0115
ON F0101JC.ABAN8 = F0115.WPAN8
WHERE DRSY = '01 '
AND DRRT = '02'
AND WPRCK7 = '1'
AND F0101JC.ABAT1 = 'C'
");
while($myRow = odbc_fetch_array( $result )) {
print_r($myRow);
}
版本:
php.x86_64 5.6.22-1.el7.remi @remi-php56
php-cli.x86_64 5.6.22-1.el7.remi @remi-php56
php-odbc.x86_64 5.6.22-1.el7.remi @remi-php56
httpd.x86_64 2.4.6-40.el7.centos @base
libphp5.so