yii2再视图里面写js代码,怎么做?

2022-03-25 20:31:32 浏览数 (2)

代码语言:javascript复制
<?php
frontendassetsAppAsset::register($this);
?>
<?php  $this->beginPage() ?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<?php $this->registerJs("alert(1)")?>
	<?php $this->head() ?>
</head>
<body>
	<?php $this->beginBody() ?>
	<?php $this->endBody() ?>
	
</body>
</html>
<?php  $this->endPage() ?>
代码语言:javascript复制
<?php $this->registerJs("alert(1)")?>

0 人点赞