在codeigniter 1.6.1中找不到类'控制器'

I'm working on an application in Codeigniter and I want to make once a day cronjobs run by a series of scripts. Earlier this worked correctly on another hosting but after doing a migration has stopped working, because I have to re-create these cronjobs.

I want to run all days this file /web/_cronjobs/application/controllers/updates.php. This performs an update in the database of the internal statistics of the web and the most important, an updated sitemap. This is the code:

http://pastie.org/10012554

I am running this statement from PuTTY:

/usr/bin/php5.5 /kunden/homepages/45/*******/htdocs/web/_cronjobs/application/controllers/updates.php

But it shows me this error:

(uiserver):*********:~ > /usr/bin/php5.5 /kunden/homepages/45/d566577055/htdocs/web/_cronjobs/application/controllers/updates.php
X-Powered-By: PHP/5.5.20
Content-type: text/html

<br />
<b>Fatal error</b>:  Class 'Controller' not found in <b>/homepages/45/d566577055/htdocs/web/_cronjobs/application/controllers/updates.php</b> on line <b>3</b><br />

I've made this possible solution but it still is the same as the version I use codeigniter is 1.6.1 and not 2.0:

codeigniter 2.0 Fatal error: Class 'Controller' not found in

I hope someone can help me, thanks! :)

2个回答



您已将控制器类放入文件并尝试直接调用它。 这不起作用。</ p>

您遇到特定错误的原因是未包含类 Controller </ code>。 当你在框架中运行时,这通常由CodeIgniter完成。 但是,由于您似乎直接调用该文件,CodeIgniter尚未加载,无法帮助您。</ p>

其次,该文件中的代码只是一个类。 我看不到应该与班级或任何东西互动的代码。 因此,即使存在类 Controller </ code>,也不会发生任何事情。</ p>

我建议你阅读这篇简短的教程 CodeIgniter - 通过CLI运行 </ p>
</ div>

展开原文

原文

You have put a controller class into a file and are trying to call it directly. This will not work.

The reason for your specific error is that the class Controller has not been included. This would normally be done by CodeIgniter when you're running things through the framework. But since you appear to be directly calling the file, CodeIgniter has not been loaded and cannot help you.

Second, the code in that file is just a class. I see no code that is supposed to interact with the class or anything. Therefore nothing would happen even if the class Controller existed.

I recommend that you read this short tutorial CodeIgniter - Running via the CLI

dsfdsf23423
dsfdsf23423 我想之前有一个脚本调用了这个控制器,最后一个托管管理员在你的服务器上。 我完全迷失了,不知道如何将这些功能作为可编程工作(cronjob)。 谢谢你的帮助castis。
5 年多之前 回复



试试这个:</ p>

  /usr/bin/php5.5 / kunden / 主页/ 45 / ******* / htdocs / web / _cronjobs / index.php更新
</ code> </ pre>
</ div>

展开原文

原文

Try this:

/usr/bin/php5.5 /kunden/homepages/45/*******/htdocs/web/_cronjobs/index.php updates

douping7975
douping7975 在_cronjobs文件夹中创建另一个php文件,比如chron.php,并且这样做$ data = file_get_contents('http://www.your-domain.com/updates'); 然后'/usr/bin/php5.5 /kunden/homepages/45/*******/htdocs/web/_cronjobs/chron.php'您可能需要修改.htacces文件以允许访问chron.php 。 请试试这个。
5 年多之前 回复
dongyun3805
dongyun3805 我试过并出现了一个错误:未定义索引:<b> /homepages/45/d566577055/htdocs/web/_cronjobs/application/config/config.php中的SCRIPT_URI config.php中的那一行:if(substr($ _ SERVER [' SCRIPT_URI'], - 9)=='index.php'|| substr($ _ SERVER ['SCRIPT_URI'], - )=='index.php /'){header('Location:'。$ config [' base_url'],TRUE,301); 谢谢Valentin
5 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问