Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 用户标识错误?_Php_Localhost_Userid - Fatal编程技术网

Php 用户标识错误?

Php 用户标识错误?,php,localhost,userid,Php,Localhost,Userid,这里怎么了 <?php if($user->getSession()){ echo '<li><a href="index.php?page=25&id=<?php echo $user[id]; ?>">My Profile</a></li>'; }else{ echo '<li><a class="butto

这里怎么了

<?php if($user->getSession()){
                echo '<li><a href="index.php?page=25&id=<?php echo $user[id]; ?>">My Profile</a></li>';
            }else{
                echo '<li><a class="button" href="#prvi">Join Us</a></li>';                 
            } ?>

其结果是:

index.php?page=25&id=<?php%20echo%20$user[id];%20?>
index.php?page=25&id=

相应地修改代码:

if($user->getSession()){
                echo '<li><a href="index.php?page=25&id='.$user[id].'">My Profile</a></li>';
            }else{
                echo '<li><a class="button" href="#prvi">Join Us</a></li>';                 
            } 
if($user->getSession()){
回音“
  • ”; }否则{ 回音“
  • ”; }
    更改

    这个

    <?php
    if($user->getSession()){
        echo '<li><a href="index.php?page=25&id=<?php echo $user[id]; ?>">My Profile</a></li>';
    }else{
        echo '<li><a class="button" href="#prvi">Join Us</a></li>';                 
    }
    ?>
    
    <?php
    if($user->getSession()){
        echo '<li><a href="index.php?page=25&id='.$user[id].'">My Profile</a></li>';
    }else{
        echo '<li><a class="button" href="#prvi">Join Us</a></li>';                 
    }
    ?>
    
    对此

    echo '<li><a href="index.php?page=25&id='.$user->id.'">My Profile</a>
    
    echo'

  • 在对象中,您必须使用
    ->
    引用它的键,就像在数组中一样
    []

    echo'
  • '-单引号之间的内容称为字符串文字。在单引号字符串文本中,php不会替换变量,而且它肯定不会“查找”其他php脚本块-它只是一个字符串文本,echo会按原样打印(或多或少)。请参阅谢谢,但不起作用,我有空页…(?)请包括
    错误报告(E_ALL);ini设置(“显示错误”,1)
    到PHP脚本的顶部并重新加载页面。任何错误?此错误?:致命错误:无法在第75行调用堆栈上的C:\wamp\www\proba\modules\profile\u user.php中使用LoginRegistration类型的对象作为数组#TimeMemoryFunctionLocation 10.0010251120{main}()..\index.php:0 20.0190361888include和它引用的文件,在第75行,到底有什么?请粘贴周围的代码,以便我能更好地理解。这个答案对博扬有帮助吗?
    echo '<li><a href="index.php?page=25&id='.$user->id.'">My Profile</a>