doushengyou2617 2015-01-11 06:45
浏览 34
已采纳

在php中收到语法错误[关闭]

while using if statement as below and assigning values to two variable I'm getting below error. Parse error: syntax error, unexpected 'Guar' (T_STRING) in /home/..../.../something.php on line 158. below is the code of line 157 and 158. I know I need to use some escape character but I don't know how to implement it here. Please help me resolve this issue. Thanks.

Code:

if($crom_name== "Groundnut pods (raw)"){$guname="DUO/LGL ;L\UM sSFRLf";$hiname="D}\UO,L SL Ol,IM\";}
if($crom_name== "Guar"){$guname="U]JFZ";$hiname="S,:8Z";}
  • 写回答

1条回答 默认 最新

  • dqq9695 2015-01-11 06:57
    关注

    Your problem is this line

    if($crom_name== "Groundnut pods (raw)"){$guname="DUO/LGL ;L\UM sSFRLf";$hiname="D}\UO,L SL Ol,IM\";}
    

    You are escaping the final quote and therefore the line should be throwing an unterminated string constant error. You need to escape the backslash. You probably also want to escape the other backslash (the one before the U.

    if($crom_name== "Groundnut pods (raw)"){$guname="DUO/LGL ;L\\UM sSFRLf";$hiname="D}\\UO,L SL Ol,IM\\";}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持