我有一個JavaScript股票磁帶是這樣的:如何PHP和JavaScript結合起來,得到一個數組紙帶
<script language="javascript">
<!--
//var message="Indigo-TX software Company Online Share Trading and mutual funds"
var message="<?php print $test1;?>"
k=message.length
spacer=".... ..."
pos=0;
function scrolling()
{
document.form12.text1.value=message.substring(pos,k)+spacer+message.substring (0,pos);
pos++;
if(pos>k){pos=0;};
setTimeout("scrolling()",200);
}
</script>
在Java腳本的這一部分上面你看到我指的是一個PHP變量。 ..
<?php
$StockMarketAPI2 = new StockMarketAPI;
$StockMarketAPI2->symbol = array('BABA', 'GPRO', 'NFLX');
<?php $test1 = ($StockMarketAPI2->getData());
但現在的紙帶只有打印:... ...陣
我應該如何改變呢?
爲了得到它來打印這通常是像這樣的內容:
Array
(
[-0.12 - -0.15%] => Array
(
[name] => Alibaba Group Holding Limited A
[price] => 81.17
[change] => -0.12
[volume] => 17910494
)
[-0.10 - -0.20%] => Array
(
[name] => GoPro, Inc.
[price] => 49.98
[change] => -0.10
[volume] => 4560482
)
[+0.53 - +0.10%] => Array
(
[name] => Netflix, Inc.
[price] => 557.03
[change] => +0.53
[volume] => 1272298
)
)
Java不是Javascript –
一個不會簡單'打印$ array;' – Huey
這不是幫助。認爲我是一個新手... – tijntest