PHP -> 解释


<?php
include ('lib/twitese.php');
if (!isLogin()) header('location: login.php');
$title = "首页";
include ('inc/header.php');
?>
<script type="text/javascript" src="js/home.js"></script>

<div id="statuses">
<?php
$t = getTwitter();
if ( isset($_POST['status']) && isset($_POST['in_reply_to']) ) {

        if (trim($_POST['status']) == '') {
            setUpdateCookie('empty');
        } else {
            $result = $t-&gt;update($_POST['status'], $_POST['in_reply_to']);
            if ($result) {
                setUpdateCookie('success');

                $user = $result-&gt;user;
                $time = time()+3600*24*365;
                if ($user) {
                        setcookie('friends_count', $user-&gt;friends_count, $time, '/',COOKIE_DOMAIN);
                        setcookie('statuses_count', $user-&gt;statuses_count, $time, '/',COOKIE_DOMAIN);
                        setcookie('followers_count', $user-&gt;followers_count, $time, '/',COOKIE_DOMAIN);
                        setcookie('imgurl', $user-&gt;profile_image_url, $time, '/',COOKIE_DOMAIN);
                        setcookie('name', $user-&gt;name, $time, '/',COOKIE_DOMAIN);
                }
            }
            else {
                setUpdateCookie('error');
            }
        }

        header('location: index.php');
    }

    if (getUpdateCookie()) {
        switch (getUpdateCookie()) {
            case 'success':
                echo "&lt;div id=\"sentTip\"&gt;发送消息成功&lt;/div&gt;";
                break;
            case 'empty':
                echo "&lt;div id=\"sentTip\"&gt;发送失败,消息不能为空&lt;/div&gt;";
                break;
            case 'error':
                echo "&lt;div id=\"sentTip\"&gt;发送消息失败,请重试&lt;/div&gt;";
                break;
            default:
                break;
        }
    }
?&gt;

&lt;?php include('inc/sentForm.php')?&gt;

&lt;?php
    $p = 1;
    if (isset($_GET['p'])) {
        $p = (int) $_GET['p'];
        if ($p &lt;= 0) $p = 1;
    }

    $statuses = $t-&gt;homeTimeline($p);

    testResult($statuses);
    $empty = count($statuses) == 0? true: false;
    if ($empty) {
        tpGetEmpty();
    } else {
        tpTimeline($statuses);

        $output = "&lt;div id=\"pagination\"&gt;";

        if ($p &gt;1) $output .= "&lt;a href=\"index.php?p=" . ($p-1) . "\"&gt;上一页&lt;/a&gt;";
        if (!$empty) $output .= "&lt;a href=\"index.php?p=" . ($p+1) . "\"&gt;下一页&lt;/a&gt;";

        $output .= "&lt;/div&gt;";

        echo $output;
    }

?&gt;

</div>

<?php
$show_stop_refresh = true;
include ('inc/sidebar.php');
?>

<?php
include ('inc/footer.php');
?>



请问这段代码中的

setcookie('friends_count', $user->friends_count, $time, '/',COOKIE_DOMAIN); 

$statuses = $t->homeTimeline($p); 

符号: ->  是什么意思?知道的帮忙解释下,不胜感激。
php
0

1个回答

->前面的变量是一个对象:

$user->friends_count
取对象的friends_count属性。

$t->homeTimeline($p)
调用对象的homeTimeline方法,方法中传入一个参数$p

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!