我如何获得信息

时间:2015-07-27 11:28:38

标签: php foreach

我有这个脚本,我需要这个结果:

Numelem / Title / ElmPoste

    foreach ( $jobPrintingInfos as $jobprinting_index => $jobprinting ) {

                    $machine      = $jobprinting ['ElmPoste'];

                    //var_dump($machine);
                //    var_dump($machine);

                }

                foreach ( $GetJobResult->Components->Component as $component_index => $component ) {

                    $quote_support ='';
                    $quote_impression = '';

                        $quote_title = ($component->NumElem) . ' / ' . $component->Title . ' ' .$machine. "\r\n";

                    var_dump($quote_title);
}

但是当我var_dump($quote_title)时,我的最后一台机器并不是所有的机器:例如

  • 1 / Dessus / Nesspresso
  • 2 / Inter / Nesspresso
  • 3 /设备与供应/ Nesspresso

提前致谢

1 个答案:

答案 0 :(得分:0)

我不知道该脚本背后的想法...但如果你想要$ quote_title< - 是一个长字符串,那么你需要添加一个。

像这样:

$quote_title .= ($component->NumElem) . ' / ' . $component->Title . ' ' .$machine. "\r\n";

-------------------- ^

或作为数组,然后它的easyer使用for循环