新版本的钩子没有生效,路径跟旧的好像不一样,有人知道怎么处理吗?
新版钩子路径还是/dayrui/hooks/ 这个吗,为什么我的执行文件无效啊,,
这是config/my_hooks.php代码
<?php
/**
* 我的钩子定义配置
*/
defined('BASEPATH') OR exit('No direct script access allowed');
/*
$hook['钩子名称'][] = array(
'class' => '类名称',
'function' => '方法名称',
'filename' => '钩子文件.php',
'filepath' => 'hooks',
);
*/
/**
* 文章发布之后
*/
$hook['content_add_after'][] = array(
'class' => 'news_hooks',
'function' => 'news_after_go',
'filename' => 'news_hooks.php',
'filepath' => 'hooks',
);/这是/diy/dayrui/hooks/add_content.php文件,钩子执行代码
<?php
/**
* Created by PhpStorm.
* User: chunjie
* Date: 14-6-23
* Time: 17:11
*/
class news_hooks {
public $ci;
/**
* 构造函数
*/
function __construct() {
$this->ci = &get_instance();
}
function news_after_go($data) {
$dir = "kefu53";
if(!is_dir($dir)){
$res=mkdir(iconv("UTF-8", "GBK", $dir),0777,true);
}
$insertinfo = file_put_contents($dir."/info.txt",date("y-m-d H:i:s",time()).PHP_EOL, FILE_APPEND);
}
/* function news_before_go($data){
if($data){
$this->ci->member_msg(SITE_ID);
}
} */
}然后我看 到/diy/poscms/config/这里目录下也有hooks.php
后面试着放在那边也是不行的。有人知道这个钩子现在是怎么样的吗