0
我正在開發Openshift應用程序。Openshift限制迴路?
請參閱此腳本:
foreach ($needle['tbody']['tr']['td'] as $key=>$values){
....
foreach($values['table']['tr']['td'] as $value){
....
foreach ($value['table']['tbody']['tr'] as $td_key => $td ){
}
node_save($node);
$value['table']['tbody']['tr'] contains this values:
Array
(
[0] => Array
(
[td] => Array
(
[@attributes] => Array
(
[class] => tinh
)
[a] => Äá»「ng Nai
)
)
[1] => Array
(
[td] =>
4K1
)
[2] => Array
(
[td] => Array
(
[@attributes] => Array
(
[class] => giai8
)
[div] => 27
)
)
[3] => Array
(
[td] => Array
(
[@attributes] => Array
(
[class] => giai7
)
[div] => 490
)
)
[4] => Array
(
[td] => Array
(
[@attributes] => Array
(
[class] => giai6
)
[div] => Array
(
[0] => 9861
[1] => 3667
[2] => 9921
)
)
)
[5] => Array
(
[td] => Array
(
[@attributes] => Array
(
[class] => giai5
)
[div] => 0262
)
)
[6] => Array
(
[td] => Array
(
[@attributes] => Array
(
[class] => giai4
)
[div] => Array
(
[0] => 95163
[1] => 89551
[2] => 99648
[3] => 39782
[4] => 69694
[5] => 09915
[6] => 90402
)
)
)
[7] => Array
(
[td] => Array
(
[@attributes] => Array
(
[class] => giai3
)
[div] => Array
(
[0] => 57076
[1] => 54943
)
)
)
[8] => Array
(
[td] => Array
(
[@attributes] => Array
(
[class] => giai2
)
[div] => 07304
)
)
[9] => Array
(
[td] => Array
(
[@attributes] => Array
(
[class] => giai1
)
[div] => 34882
)
)
[10] => Array
(
[td] => Array
(
[@attributes] => Array
(
[class] => giaidb
)
[div] => 339136
)
)
)
在foreach($值 '表'] [ 'TBODY'] [ 'TR']爲$ td_key => $ TD){...只有循環2次,無法到達node_save($ node);.我不知道是否Openshift限制循環? 此腳本在localhost上正常工作。
感謝Nam Duong。 'code' – user2245374 2013-04-07 06:51:05
當我檢查$ td ['td'] ['@ attributes'] ['class']的條件時,PHP日誌顯示錯誤。在我評論所有檢查後,foreach遍歷數組$ value ['table'] ['tbody'] ['tr']中的所有項。 錯誤是PHP致命錯誤:不能使用字符串偏移作爲數組。 var_dump($ td ['td'])---->是數組 var_dump($ td ['td] ['@ attributes'])---->是數組 var_dump($ td ['td] ['@attributes'] ['class'])--->是數組 。所以,爲什麼PHP顯示錯誤? – user2245374 2013-04-07 07:10:12