::是取类的成员函数的时候用到的吧。
->是类的东西的属性,比如$cls->a="b";就是让cls这个类里面的$this->a也就是var $a这个变量值为b。

解决方案 »

  1.   

    VB
    thing.text="hi!"
    PHP
    thing->text="hi!"
      

  2.   

    ::取类中的静态涵数用的;  好象C++中有讲过的
    ->是调用类的属性和方法吧    $clss1->a;   $class1->do();
      

  3.   

    :( 还是不很清楚。
    如:
    class mycls{
       var $a=0;
       function exc($str){
          echo $str;
       }
    }
    $cls=new mycls;
    用exc和a的时候都是 $cls->exc() or $cls->a;
    但什么时候用::呢?能举个小例子吗?
      

  4.   

    哈哈,我就是学VB,asp过来的,PHP中的"->"就是Vb中的"."
      

  5.   

    rs.field("name")PHP:rs->field("name")
      

  6.   

    <?php
    class test
    {
    static public $one="surfchen";
    static private $tow="wolfzeus";
    function __construct()
    {
    $this->user=self::$tow;
    }
    }
    echo test::$one;//output surfchen
    $test=new test;
    echo $test->user;//output wolfzeus
    ?>
      

  7.   

    不想实例化的时候,也就不想$cls=new mycls;的时候,就用::,类名::方法或变量.效果一样的。
      

  8.   

    <?php
    class me
    {
    static public $me="surfchen";
    static protected $wife="wolfzeus";
    public function MySkill()
    {
    return "programme";
    }
    protected function MyWifeSkill()
    {
    return "basketball";
    }
    private function OurSleep()
    {
    return "Love";
    }
    }
    class myson extends me
    {
    function __construct()
    {
    $this->father=me::$me;
    }
    protected function mother()
    {
    return $this->mother=me::$wife;
    }
    public function SonSkill()
    {
    return me::MySkill()." and ".me::MyWifeSkill();
    }
    }
    $me=new me;
    $son=new myson;
    echo "My name is ".me::$me.",good at ".$me->MySkill()."<br />";
    echo "I have a wife,but I can't tell you what her name is and what skill she has.(MyWifeSkill() is protected)<br />";
    echo "Our loves and lives is private,so......<br />";
    echo "We have a son,he good at ".$son->SonSkill().".";
    ?>
      

  9.   

    谢谢surfchen(冲浪) 和上面的几位,我明白了。但是我在测试的时候,出现了以下错误:
    Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\usr\www\html\test\test.php on line 4我用的源码是:
    <?php
    class test
    {
    static public $one="surfchen";
    static private $tow="wolfzeus";
    function __construct()
    {
    $this->user=self::$tow;
    }
    }
    echo test::$one;//output surfchen
    $test=new test;
    echo $test->user;//output wolfzeus
    ?>
    是不是我的PHP用问题呢?
      

  10.   

    拿本C++或者JAVA的基础书看看就知道了
      

  11.   

    我的代码都是以PHP5为平台的...PHP4不兼容...不过从代码上说跟PHP4也差不多....
      

  12.   

    vb里面没有类似于::的东西
    php4的例子class test{
    function func1(){
    echo "this is func1";
    }
    var $field=10;
    }
    echo test::field;
    test::func1();
      

  13.   

    ::在PHP4里的一个作用是继承被覆写的父类的方法<?php
    class father
    {
    function skill()
    {
    return "php";
    }
    }class son extends father
    {
    function skill()
    {
    return "wml";
    }
    function FatherSkill()
    {
    return parent::skill();
    }
    }
    $son=new son;
    echo $son->FatherSkill();
    ?>