doujiao1948 2013-11-26 17:50
浏览 240
已采纳

使用PHP 5.4的Dreamweaver CS5代码提示和语法错误

I have done some research but have not found something that fits my scenario exactly. I am using Dreamweaver CS5 with PHP files and Dreamweaver alerts me that there is an error in my code with this line:

if(explode("_","some_variable")[0]=="some"){

If I remove the brackets [ ] then the error message goes away making the line be

if(explode("_","some_variable")=="some"){ //never true obviously

I know that I could assign the exploded array to a variable and then call the first value of that variable to remove this code but I was trying to find a solution to be able to write a little more shorthand code.

I found that this method of calling an index is supported from PHP version 5.4 from the answer here: https://stackoverflow.com/a/19408331/1707323 but Dreamweaver still throws error alert. I was able to find out that Dreamweaver CS5 supports code hinting and syntax for PHP version 5.2.

So the main question is: How can I add more support to Dreamweaver CS5 code hinting and syntax checker OR is there a way to ignore certain syntax errors while preserving the rest of the syntax checker?

I know that I could change the line to

if($string = explode("_",$key) && $string[0]=="understand"){

Or I could write a custom function such as the referred answer above suggests, but why write extra code just to satisfy an outdated syntax checker when there might be a way to update the syntax checker.

Note: I am not looking for any answers that involves updating to a newer version of Dreamweaver such as CS5.5 or CS6 as I already have CS5 and do not want to dish out money just for this reason.

  • 写回答

2条回答 默认 最新

  • dsv38843 2014-01-29 15:52
    关注

    The short answer is you can't extend code syntax for CS5. Adobe doesn't support older versions of Dreamweaver and there will not be a patch for it. They want you to upgrade to the latest (subscription-based) version instead.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀