English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
في حالة وجود عدة طرق في فئة واحدة، عند إنشاء نموذج لهذه الفئة وتشغيل الطريقة، يمكنك تشغيلها واحدة تلو الأخرى، مثل:
db.php
<?php class db { public function where() { //code here } public function order() { //code here } public function limit() { //code here } }
index.php
<?php $db = new db(); $db->where(); $db->order(); $db->limit();
إذا كنت ترغب في تنفيذ النداء المتسلسل، فعليك إضافة return $this في نهاية الطريقة.
db.php
<?php class db { public function where() { //code here return $this; } public function order() { //code here return $this; } public function limit() { //code here return $this; } }
index.php
<?php $db = new db(); $db->where()->order()->limit();
هذا هو كل محتوى التفصيل في تنفيذ التشغيل المتسلسل في PHP الذي قدمته لك، آمل أن يكون مرجعًا لك، وأتمنى أن تدعموا دائمًا تعليمات النفخ.