语法错误-意外的“:" [英] Syntax error - unexpected ":"

查看:53
本文介绍了语法错误-意外的“:"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的php脚本根据所按下的提交按钮定向到一个URL.但是,当我运行测试时,我收到一条错误消息,说第4行包含意外的:",但第4行是带有url的标头脚本?

My php script directs to a url depending on which submit button was pressed. However, when I run the test I'm getting an error saying line 4 contains an unexpected ":" but my line 4 is my header script with the url?

我很困惑,因为我有其他与此类似的脚本,但它们没有给我这个错误.谁能告诉我我所缺少的东西,可能很简单,我之前曾被发现很简单.

I'm confused because I have other scripts similar to this and they don't give me that error. Can anyone tell me what I'm missing, might be simple, I have been caught being simple before.

<?php
if ($_REQUEST['Dish1'] == 'Dish1')
{
header("Location: http://blahblah".urlencode($_POST[‘uid’]));
}
else if ($_REQUEST['Dish1'] == 'Dish2')
{
header("Location: http://blahblah2".urlencode($_POST[‘uid’]));
}
else if ($_REQUEST['Dish1'] == 'Dish3')
{
header("Location: http://blahblah3".urlencode($_POST[‘uid’]));
}
etc.....
?>

推荐答案

您正在使用弯引号.

分别将所有 ‘ ’分别替换为"'.

Replace all the " " and ‘ ’ to " and ' respectively.

这篇关于语法错误-意外的“:"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆