js使用php变量
2021-03-19 10:26
标签:dir json stc encode block array data str extend php js 控制台输出结果 文本 js使用php变量 标签:dir json stc encode block array data str extend 原文地址:https://www.cnblogs.com/mg007/p/12755292.htmlphp
‘标题1‘,
‘content‘ => ‘内容1‘
],
[
‘title‘ => ‘标题2‘,
‘content‘ => ‘内容2‘
]
];
?>
laravel
class TestController extends Controller
{
function test()
{
$data = [];
$data[‘text‘] = ‘文本‘;
$data[‘articles‘] = [
[
‘title‘ => ‘标题1‘,
‘content‘ => ‘内容1‘
],
[
‘title‘ => ‘标题2‘,
‘content‘ => ‘内容2‘
]
];
return view(‘test/test‘,$data);
}
}
结果
Array(2)
0: {title: "标题1", content: "内容1"}
1: {title: "标题2", content: "内容2"}
length: 2
下一篇:js判断是否可以打开本地软件