2014-01-13 30 views
0

我想删除一个通道中的所有数据。而且我发现,要删除频道的所有入口最好的办法是删除该通道并重新创建它按照本文: https://expressionengine.stackexchange.com/questions/7648/what-is-the-best-way-to-delete-every-entry-in-a-channel删除通道中的每个条目 - 表达式引擎

,我试图删除频道关注这篇文章: http://ellislab.com/expressionengine/user-guide/development/api/api_channel_structure.html

我知道SITE_ID是1和通道的,我需要删除CHANNEL_ID为1 但是,当我尝试这些代码:

ee()->load->library('api'); ee()->api->instantiate('channel_structure'); 
$channel_id = 1;$site_id = 1; 
ee()->api_channel_structure->delete_channel((int) $channel_id, [(int) $site_id]); 

我得到这个错误:

Parse error: syntax error, unexpected T_STRING in /var/www/vhosts/au/admin/expressionengine/libraries/Functions.php(679) : eval()'d code on line 7

我试着用:

ee()->api_channel_structure->delete_channel((int) 1, [(int) 1]); 
ee()->api_channel_structure->delete_channel(1, 1); 

但得到了同样的问题。

有人知道如何解决这个问题。非常感谢!

+0

如果您没有得到您希望的回复,我建议您在专用的EE网站上发布:http://expressionengine.stackexchange.com/ – AllInOne

回答

0

在EE文档中(int)表示期望值是整数。另外,文档约定是方括号表示可选值。

如果我正确阅读它们,它们都不属于代码的一部分。我认为这是你想要什么:

ee()->load->library('api'); 
ee()->api->instantiate('channel_structure'); 
$channel_id = 1; 
$site_id = 1; 
ee()->api_channel_structure->delete_channel($channel_id, $site_id); 
0

尝试增加& perpage = 1000到编辑频道条目屏幕上的查询字符串的结尾......

例如 /admin.php?S=de47727e64b2e445cfee64c85a219977c9b62474&D=cp&C=content_edit&perpage=1000

如果内存不足,请使用较低的数字。