Maison >développement back-end >tutoriel php >这种带箭头的写法是啥回事呢
面向对向
帝国cms是一个用过程来写的php网站,但是我发现它里面还有用箭头来写的语句,不是说,这种带箭头的写法是面向对向的吗,为啥在过程的网站里也出现这种箭头呢,难道它另有含义吗? 你 print_r($empire); 不就能看到他是什么了吗?
为啥在过程的网站里也出现这种箭头呢
形而上?这有点非白即黑的感觉
你 print_r($empire); 不就能看到他是什么了吗?
为啥在过程的网站里也出现这种箭头呢
形而上?这有点非白即黑的感觉
我print_r的结果是
mysqlquery Object ( [dblink] => [sql] => Resource id #75 [query] => [num] => [r] => Array ( [0] => 15 [classid] => 15 [1] => 11 [bclassid] => 11 [2] => 腰椎间盘突出治疗 [classname] => 腰椎间盘突出治疗 [3] => [sonclass] => [4] => 0 [is_zt] => 0 [5] => 6 [lencord] => 6 [6] => 10 [link_num] => 10 [7] => 18 [newstempid] => 18 [8] => 0 [onclick] => 0 [9] => 16 [listtempid] => 16 [10] => |7|11| [featherclass] => |7|11| [11] => 1 [islast] => 1 [12] => jzk/yztc/zl [classpath] => jzk/yztc/zl [13] => .html [classtype] => .html [14] => Y-m-d [newspath] => Y-m-d [15] => 0 [filename] => 0 [16] => .html [filetype] => .html [17] => 0 [openpl] => 0 [18] => 0 [openadd] => 0 [19] => 10 [newline] => 10 [20] => 10 [hotline] => 10 [21] => 10 [goodline] => 10 [22] => [classurl] => [23] => 0 [groupid] => 0 [24] => 0 [myorder] => 0 [25] => [filename_qz] => [26] => 10 [hotplline] => 10 [27] => 11 [modid] => 11 [28] => 1 [checked] => 1 [29] => 10 [firstline] => 10 [30] => 腰椎间盘突出治疗 [bname] => 腰椎间盘突出治疗 [31] => 1 [islist] => 1 [32] => 0 [searchtempid] => 0 [33] => 10 [tid] => 10 [34] => gkbz [tbname] => gkbz [35] => 0 [maxnum] => 0 [36] => 0 [checkpl] => 0 [37] => 2 [down_num] => 2 [38] => 2
也不知这说明了啥
$empire 肯定是个对象。
你 print_r($empire); 不就能看到他是什么了吗?
为啥在过程的网站里也出现这种箭头呢
形而上?这有点非白即黑的感觉
我print_r的结果是
mysqlquery Object ( [dblink] => [sql] => Resource id #75 [query] => [num] => [r] => Array ( [0] => 15 [classid] => 15 [1] => 11 [bclassid] => 11 [2] => 腰椎间盘突出治疗 [classname] => 腰椎间盘突出治疗 [3] => [sonclass] => [4] => 0 [is_zt] => 0 [5] => 6 [lencord] => 6 [6] => 10 [link_num] => 10 [7] => 18 [newstempid] => 18 [8] => 0 [onclick] => 0 [9] => 16 [listtempid] => 16 [10] => |7|11| [featherclass] => |7|11| [11] => 1 [islast] => 1 [12] => jzk/yztc/zl [classpath] => jzk/yztc/zl [13] => .html [classtype] => .html [14] => Y-m-d [newspath] => Y-m-d [15] => 0 [filename] => 0 [16] => .html [filetype] => .html [17] => 0 [openpl] => 0 [18] => 0 [openadd] => 0 [19] => 10 [newline] => 10 [20] => 10 [hotline] => 10 [21] => 10 [goodline] => 10 [22] => [classurl] => [23] => 0 [groupid] => 0 [24] => 0 [myorder] => 0 [25] => [filename_qz] => [26] => 10 [hotplline] => 10 [27] => 11 [modid] => 11 [28] => 1 [checked] => 1 [29] => 10 [firstline] => 10 [30] => 腰椎间盘突出治疗 [bname] => 腰椎间盘突出治疗 [31] => 1 [islist] => 1 [32] => 0 [searchtempid] => 0 [33] => 10 [tid] => 10 [34] => gkbz [tbname] => gkbz [35] => 0 [maxnum] => 0 [36] => 0 [checkpl] => 0 [37] => 2 [down_num] => 2 [38] => 2
也不知这说明了啥
这说明$empire是一个mysql数据库查询后的结果集对象。这个对象保存着sql语句查询的结果。
mysqlquery Object 不就是说
$empire 是一个派生于 mysqlquery 的对象吗
我听QQ群中说,这个是一个类,即过程也有类。真搞不明白
如果你用过ORM、框架之类的,你会发现其实在面向过程的方法中用面向对象的调用实在是太普遍了。
创建一个对象,然后赋值,最后保存,可以这么来:
$student=new Student();
$student->setName='Peter';
$student->setSex='M';
$entityManager->persist($student);
$entityManager->flush();
对象调用!!
去看下面向对象的知识吧。
面向对象不更好吗?