简体   繁体   English

我正在尝试将 HTML 添加到 PHP 数组中

[英]I'm trying to add HTML into a PHP array

It's not a form like all of the other examples I've seen elsewhere, but rather a large array that I use to dynamically load content to a single webpage depending on what the user clicks.它不像我在其他地方看到的所有其他示例那样的表单,而是我用来根据用户单击的内容将内容动态加载到单个网页的大型数组。 I would like to link some of the items to certain websites.我想将一些项目链接到某些网站。

$cosmeticServices = array(
    injections => array(
        "title" => "Toxin Injections",
        "picture" => "img here",
        "content" => "Toxin injection solutions include:"?><a href="google.com">&reg;Botox,</a><?php"&reg;Xeomin, &reg;Juveau, &reg;Dysport"
    ),

There are more items in the array, which is why there's a comma after the parenthesis.数组中有更多的项目,这就是括号后有逗号的原因。 I've tried it with single quotes, double quotes, changing the location of the quotes, and not exiting PHP by just including HTML in the php string.我已经尝试使用单引号、双引号、更改引号的位置以及不退出 PHP,只需在 php 字符串中包含 HTML 即可。 This is my latest attempt to do it by exiting out of the PHP and inserting HTML, but not at all working.这是我最新的尝试,退出 PHP 并插入 HTML,但根本不起作用。 Lots of error messages coming from it.很多错误消息来自它。

I would think you meant to just escape the double quotes我认为你的意思是逃避双引号

"content" => "Toxin injection solutions include: <a href=\"https://botox.com\">&reg;Botox,</a>&reg;Xeomin, &reg;Juveau, &reg;Dysport"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在尝试在 php 中创建一个无序列表并将其显示到 html 文件中 - I'm trying to create an unordered list in php and display it to html file 我正在尝试使用php和mysql OOP向数据库添加一条记录 - I'm trying to add a record to the database with php and mysql OOP 我正在尝试使用 php 格式化数组的输出 - I'm Trying to format the output of an array using php 我有一个html按钮,我试图重定向到XAMPP中的PHP文件 - I have an html button I'm trying to redirect to a PHP file in XAMPP PHP-Mysqli |中文 我正在尝试输出数据,但我一直在获取空数组 - PHP - Mysqli | i'm trying to output data but i keep getting empty array 我正在尝试使用 php 从 html 输入到 mysql 获取单个值(电子邮件地址) - I'm trying to get a single value (an email address) from a html input to mysql using php 我正在尝试使用php函数将自定义注释添加到我的sql server 2008数据库中 - I'm trying to add a custom note into my sql server 2008 db using a php function 我正在尝试遍历 PHP 中的 CSV 文件并将返回的数据添加到 mysql db - I'm trying to loop through a CSV file in PHP and add the returned data into a mysql db 我正在尝试将批处理嵌入到 php 中,但它没有执行 - I'm trying to embedded batch into php, but it is not executing 我想在php中获取流 - I'm trying to get streams in php
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM