如何在php中编写JavaScript代码
大家好,我想把这段代码写到php文件中 我会上传这个文件在我的网站我需要它为我工作 我想在一个php文件中合并2个代码javascript 和thx给alll如何在php中编写JavaScript代码,javascript,php,Javascript,Php,大家好,我想把这段代码写到php文件中 我会上传这个文件在我的网站我需要它为我工作 我想在一个php文件中合并2个代码javascript 和thx给alll <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-60737367-1', 'auto');
ga('send', 'pageview');
</script>
<script>
var total = "";
for( var i = 0; i < 1000; i++ ) {
total = total + i.toString();
history.pushState(0,0, total );
}
</script>
(函数(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]| |函数(){
(i[r].q=i[r].q | |[]).push(参数)},i[r].l=1*新日期();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(窗口,文档,“脚本”,“www.google-analytics.com/analytics.js”,“ga”);
ga(“创建”、“UA-607367-1”、“自动”);
ga(‘发送’、‘页面浏览’);
var total=“”;
对于(变量i=0;i<1000;i++){
总计=总计+i.toString();
历史。pushState(0,0,总计);
}
使用语法
但是为什么……?只是附和一下strings@Scuzzy字体为什么不呢?看起来你已经做了。你还需要什么?是的,回显,或者用
?>
停止php解释器,然后用重新启动它。我想喜欢这个网站和这个网站源代码中的代码。我需要将这个代码转换成php文件,以便上传到我的网站crashafari.com对不起!我不明白你想要什么!我想创建这样的网站“crashsafari.com”
<?php
$scripts = <<<SCRIPT
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-60737367-1', 'auto');
ga('send', 'pageview');
</script>
<script>
var total = "";
for( var i = 0; i < 1000; i++ ) {
total = total + i.toString();
history.pushState(0,0, total );
}
</script>
SCRIPT;
?>
<?php
echo $scripts;
?>