How can I use a '
and a "
in a php string?
I can't use one of them because I have used both in my website code and I think it's better and easier if I make a class for the website that than just echo everything.
在PHP字符串中使用'和'[关闭]
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- dongwu9063 2014-04-20 23:51关注
first of all you can escape then
"this is \" and ' in a string"
or you can use HEREDOC instead
$string = <<<STR this is a "string" with 'signs' and {$some_var} if needed STR;
Note this rules though: 1. The choose of
STR
was arbitrary and you can use any phrase you would like (no spaces). 2. The row with theSTR;
must contain NOTHING but it (not even spaces after)本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
- ¥15 (标签-MATLAB|关键词-多址)
- ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
- ¥500 52810做蓝牙接受端
- ¥15 基于PLC的三轴机械手程序
- ¥15 多址通信方式的抗噪声性能和系统容量对比
- ¥15 winform的chart曲线生成时有凸起
- ¥15 msix packaging tool打包问题
- ¥15 finalshell节点的搭建代码和那个端口代码教程
- ¥15 Centos / PETSc / PETGEM