How to Initialize php variable with javascript? -


hello have email sent clients like: $body = '<div>my email content</div>'; , need add $body variable script google api:

<script type="application/ld+json"> {   "@context": "http://schema.org",   "@type": "lodgingreservation",   "reservationnumber": "abc456",   "reservationstatus": "http://schema.org/confirmed",   "undername": {     "@type": "person",     "name": "john smith"   },   "reservationfor": {     "@type": "lodgingbusiness",     "name": "hilton san francisco union square",     "address": {       "@type": "postaladdress",       "streetaddress": "333 o'farrell st",       "addresslocality": "san francisco",       "addressregion": "ca",       "postalcode": "94102",       "addresscountry": "us"     },     "telephone": "415-771-1400"   },   "checkindate": "2017-04-11t16:00:00-08:00",   "checkoutdate": "2017-04-13t11:00:00-08:00" } </script> 

how can that? ideas? can not change " '.

if understood question, should looking for:

$script = <<<eof <script type="application/ld+json"> {   "@context": "http://schema.org",   "@type": "lodgingreservation",   "reservationnumber": "abc456",   "reservationstatus": "http://schema.org/confirmed",   "undername": {     "@type": "person",     "name": "john smith"   },   "reservationfor": {     "@type": "lodgingbusiness",     "name": "hilton san francisco union square",     "address": {       "@type": "postaladdress",       "streetaddress": "333 o'farrell st",       "addresslocality": "san francisco",       "addressregion": "ca",       "postalcode": "94102",       "addresscountry": "us"     },     "telephone": "415-771-1400"   },   "checkindate": "2017-04-11t16:00:00-08:00",   "checkoutdate": "2017-04-13t11:00:00-08:00" } </script> eof;  $body = '<div>my email content</div>' . $script; 

more heredoc

probably you'll need use htmlentities() method encode special characters


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -