में घटकों का उपयोग करके मैं अपने आवेदन के लिए केकफ़्फ़ खोल का उपयोग करके एक कार्य को लागू करने की कोशिश कर रहा हूं। कार्य में एक लंबी चल रही प्रक्रिया (इसलिए खोल का उपयोग करने की आवश्यकता) चलाना शामिल है।केकफ़्प 2+ शैल
समारोह मुझे एक घटक CommonComponent
कहा जाता है के अंदर एक समारोह का उपयोग करने की आवश्यकता है दुर्भाग्य से जब भी मैं घटक मैं निम्न त्रुटि पीएचपी गंभीर त्रुटि प्राप्त शामिल करने के लिए प्रयास करें: क्लास 'घटक'/var/www में नहीं मिला /nginx-test/app/Controller/Component/CommonComponent.php
यहाँ CronShell कक्षा जो
class CronShell extends AppShell {
public function main() {
$this->out('Hello world.');
// $this->out(phpinfo());
}
public function test()
{
$this->out('Before Import');
App::import('Component', 'Common');
$this->out('Import complete');
// $this->Common=ClassRegistry::init('CommonComponent');
$this->Common =new CommonComponent();
$this->out('Initialization complete');
$this->Common->testCron();
$this->out('FunctionCall complete');
//$this->Common->saveCacheEntry("name","value");
}
}
बुलाया जा रहा है CommonComponent वर्ग एप्लिकेशन/नियंत्रक/Compon के रूप में जमा किया जाता है ent/CommonComponent.php और निम्नानुसार है
class CommonComponent extends Component
{
function testCron()
{
$this->out('Hello world from Component.');
}
}
कोई विचार?
स्वीकृत उत्तर को अपडेट करने पर विचार करें? –