📜  如何在 php 中添加 javascript - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:02.275000             🧑  作者: Mango

代码示例1
//this is my code 

you can add javascript to your code by using the echo statement and rap all 
your javascript between "" and if there is "" in the javascript code
then add \ before any "", and for the php inside rap it with ''
  
  
document.write(\"hello world\")"
?>
  
//other example

document.write('$a')"
?>

//other example
  

             localStorage.setItem(\"id\", '$TokenData->id');
             localStorage.setItem(\"name\", '$TokenData->name');
             localStorage.setItem(\"email\", '$TokenData->email');
       ";