语法错误:意外令牌' $ current_user'第97行

时间:2015-04-01 20:40:56

标签: php

            <!-->This is the new code I am trying to add<!-->
            <?php if $current_user = 'test' { ?>
            <script type="text/javascript" src="https://cimulus.atlassian.net/s/fe43f6fc5a628824d47590ead0fc6aee-T/en_US-iikkpb/64014/28/1.4.24/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?locale=en-US&collectorId=2a7a4da1"></script>
            }

我正在尝试添加一个html脚本,该脚本仅为用户显示一个按钮&#34; test&#34;但我继续在第97行获得此语法错误,这就是这一行。我真的不明白我做错了什么。

<?php if (TEST_MODE) { ?>

1 个答案:

答案 0 :(得分:0)

底部有一些错误:if上缺少方括号,您使用了=而不是==,最后的大括号超出了<?php标记。 ..

<!-- This is the new code I am trying to add -->
<?php if ($current_user == 'test') { ?>
<script type="text/javascript" src="https://cimulus.atlassian.net/s/fe43f6fc5a628824d47590ead0fc6aee-T/en_US-iikkpb/64014/28/1.4.24/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?locale=en-US&collectorId=2a7a4da1"></script>
<?php } ?>