$ Anlamı bu->

3 Cevap php

Possible Duplicate:
PHP: self vs. $this

$this-> CakePKP'deki ne demek?

Please answer this in two parts... What does $this refer to? What does -> refer to?

Birisi bu-> Post-> ('all') bulmak deyimi $ açısından açıkça her bölümünü açıklayabilir miyim; Mesaj denetleyicisi. Bu Mesajlar denetleyicisi ise> Post kısmını - Neden ihtiyacım var?

3 Cevap

$ Eğer bu kullanmak istediğiniz sınıfa gelir. Eğer $ this-> Post-> ('all') bulmak görürseniz Örneğin, sen AppModel genişleten sınıf Mesaj erişmeye çalışıyoruz. Sözleşmeler yoluyla, Mesaj Model veritabanındaki mesaj tablosunu kullanır. AppModel find () metodu vardır ve post modeli AppModel uzanır çünkü $ this-> Post-> ('all') bulmak için kullanılır.

http://api.cakephp.org/class/app-model http://book.cakephp.org/view/22/CakePHP-Conventions

Bir Object reference geçerli nesne olmaktır.

Kesinlikle CakePHP dalmadan önce PHP documentation on classes okumak isteyeceksiniz

Resmi referanstan:

Every class definition begins with the keyword class, followed by a class name, which can be any name that isn't a reserved word in PHP. Followed by a pair of curly braces, which contains the definition of the classes members and methods. A pseudo-variable, $this is available when a method is called from within an object context. $this is a reference to the calling object (usually the object to which the method belongs, but can be another object, if the method is called statically from the context of a secondary object).

Tanımların çoğu uyduruk, ama bu gerçekten CakePKP'deki kod gezinmek bilmek zorunda kalacaksın şeyler değil.