1、安装报错,新版本php不支持mysql_connect;【安装支持老版本的mysql扩展始终报错HP Warning: PHP Startup: Unable to load dynamic library ‘mysql.so’ (tried: /usr/lib64/php/modules/mysql.so (/usr/lib64/php/modules/mysql.so: undefined symbol: mysqlnd_get_client_info), /usr/lib64/php/modules/mysql.so.so (/usr/lib64/php/modules/mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

(1)对安装index.php的数据库操作进行改写

public function successAction() {  if (IS_POST){ C($_POST);//$db = mysqli_connect($host,$user,$passwd,$database,$port);  //if (!@mysql_connect($_POST['mysql_master_host'].':'.$_POST['mysql_master_port'],$_POST['mysql_master_user'],$_POST['mysql_master_pwd']))//$dbcon= mysqli_connect($_POST['mysql_master_host'],$_POST['mysql_master_user'],$_POST['mysql_master_pwd'],$_POST['mysql_master_name'],$_POST['mysql_master_port']);  $dbcon= mysqli_connect($_POST['mysql_master_host'],$_POST['mysql_master_user'],$_POST['mysql_master_pwd'],'webdb',$_POST['mysql_master_port']);// 检查连接 if (!$dbcon){die("连接错误: " . mysqli_connect_error());}if (!@dbcon){ $this->error('数据库帐号密码错误');}if (!@dbcon){ $this->error('数据库帐号密码错误'); } //mysqli_fetch_assoc(result);规定由 mysqli_query()、mysqli_store_result() 或 mysqli_use_result() 返回的结果集标识符。//mysql_query('show tables', $Con ); 也可以省略第二个参数,写成:mysql_query('show tables');//但是mysqli不行 mysqli_query( $Con,  'show tables');//mysqli_query(connection,query,resultmode);connection    必需。规定要使用的 MySQL 连接。query    必需,规定查询字符串。//resultmode可选。一个常量。可以是下列值中的任意一个:MYSQLI_USE_RESULT(如果需要检索大量数据,请使用这个)MYSQLI_STORE_RESULT(默认)//if (!isset($_SERVER['HTTP_BAE_LOGID']) && !mysql_fetch_assoc(mysql_query("SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA` WHERE `SCHEMA_NAME`='{$_POST['mysql_master_name']}' LIMIT 0, 1;")))//{ if (!mysql_query("CREATE DATABASE IF NOT EXISTS `{$_POST['mysql_master_name']}` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;"))if (!isset($_SERVER['HTTP_BAE_LOGID']) && !mysqli_fetch_assoc(mysqli_query($dbcon,"SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA` WHERE `SCHEMA_NAME`='{$_POST['mysql_master_name']}' LIMIT 0, 1;"))){ if (!mysqli_query($dbcon,"CREATE DATABASE IF NOT EXISTS `{$_POST['mysql_master_name']}` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;"))     { $this->error('数据库不存在,尝试创建失败!'); } } $zym_7=F(APP_PATH.'/install/data/mysql.sql'); if (!$zym_7){ $this->error('读取数据库安装信息失败,请检查程序完整性',0,0); } $zym_7=strtr($zym_7,array( '{adminuser}'=>$_SESSION['install']['adminuser'], '{salt}'=>substr(md5(NOW_TIME),0,6), '{adminpwd}'=>md5(md5($_SESSION['install']['adminpwd']).substr(md5(NOW_TIME),0,6)), '{installsitename}'=>$_SESSION['install']['sitename'], '{installsiteurl}'=>$_SESSION['install']['siteurl'], '{mysql_driver}'=>C('mysql_driver'), '{mysql_prefix}'=>C('mysql_prefix'), '{mysql_master_host}'=>C('mysql_master_host'), '{mysql_master_port}'=>C('mysql_master_port'), '{mysql_master_name}'=>C('mysql_master_name'), '{mysql_master_user}'=>C('mysql_master_user'), '{mysql_master_pwd}'=>C('mysql_master_pwd'), )); $zym_5=new model(); $zym_6=explode(";\n",$zym_7); foreach($zym_6 as $zym_7){ $zym_5->execute(trim($zym_7).';'); } M('config')->createConfigFile(); F(CACHE_PATH,null); F(DATA_PATH,null); F(DATA_PATH.'/install.lock','PTcms Install Lock File!'); $this->admin=$_SESSION['install']; $_SESSION['install']=null; } $this->display('success'); }
vim  /usr/share/wwwphp/ptcms/application/install/controller/index.php
service nginx restart

系统安装成功


安装成功!
您的管理员账户是: admin
您的管理员密码是: admin
参与用户调查, 帮助我们完善产品您可以将下面两个链接保存到您的收藏夹:[点击这里访问您的控制面板](http://localhost/admin.php)[点击这里查看您的网站](http://localhost/index.php)希望您能尽情享用 PT小说聚合程序 带来的乐趣!

2 进入系统后台进行设置
(1)为了方便调试,让主机访问虚拟机地址
ifconfig -a
vmware改为桥连接且复制物理连接

(2)fedora防火墙设置允许非本机访问

systemctl start firewalld.service
firewall-cmd --state
firewall-cmd --get-active-zonesFedoraWorkstationinterfaces: ens33firewall-cmd --permanent --zone=FedoraWorkstation --add-port=80/tcp
firewall-cmd --permanent --zone=FedoraWorkstation --add-service=http
systemctl restart firewalld.service

防火墙基础操作

systemctl stop firewalld.service
systemctl start firewalld.service
systemctl restart  firewalld.service//查看防火墙状态
firewall-cmd --state
//输出
running//查看活动区域并附带网络接口
firewall-cmd --get-active-zones
//输出
FedoraWorkstationinterfaces: enp3s0//通过网络接口查看对应的区域
firewall-cmd --get-zone-of-interface=enp3s0
//输出
FedoraWorkstation//通过区域名获得所有网络接口
firewall-cmd --zone=FedoraWorkstation --list-interfaces
//输出
enp3s0//通过区域名获得此区域的信息
firewall-cmd --zone=FedoraWorkstation --list-all
//输出
FedoraWorkstation (default, active)interfaces: enp3s0sources:services: dhcpv6-client mdns samba-client sshports: 1025-65535/udp 1025-65535/tcpmasquerade: noforward-ports:icmp-blocks:rich rules://查看当前区域活动的services
firewall-cmd --get-service
//输出
amanda-client amanda-k5-client bacula bacula-client dhcp dhcpv6 dhcpv6-client dns freeipa-ldap freeipa-ldaps freeipa-replication ftp high-availability http https imaps ipp ipp-client ipsec kadmin kerberos kpasswd ldap ldaps libvirt libvirt-tls mdns mountd ms-wbt mysql nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3s postgresql privoxy proxy-dhcp puppetmaster radius rpc-bind samba samba-client sane smtp squid ssh synergy telnet tftp tftp-client tor-socks transmission-client vnc-server wbem-https xmpp-bosh xmpp-client xmpp-local xmpp-server//增加端口到防火墙中
firewall-cmd --zone=FedoraWorkstation --add-port=8080/tcp --permanent
firewall-cmd --zone=FedoraWorkstation --add-port=5060-5061/udp --permanent
//删除
firewall-cmd --zone=FedoraWorkstation --remove-port=8080/tcp
firewall-cmd --zone=FedoraWorkstation --remove-port=5060-5061/udp//增加服务到防火墙中
firewall-cmd --zone=FedoraWorkstation --add-service=smtp --permanent
//删除
firewall-cmd --zone=FedoraWorkstation --remove-service=smtp

(3)Warning: count(): Parameter must be an array or an object that implements Countable in /usr/share/wwwphp/ptcms/application/admin/controller/index.php on line 2
php7.2之后

[1]each函数已被废弃
之前版本写法:

<?php$array = array();each($array);// Deprecated:  The each() function is deprecated. This message will be suppressed on further calls

在7.2版本中会提示过时,可以使用foreach替代each方法,也可以自己修改each方法替代:

<?phpfunction func_new_each(&$array){$res = array();$key = key($array);if($key !== null){next($array); $res[1] = $res['value'] = $array[$key];$res[0] = $res['key'] = $key;}else{$res = false;}return $res;}

[2]当传递一个无效参数时,count()函数将抛出warning警告:
之前版本写法
<?php
count(’’);

    // Warning:  count(): Parameter must be an array or an object that implements Countable

在7.2版本中将严格执行类型区分,参数类型不正确,将会出现警告,所以需要在使用count方法时注意参数的值,不过也可以通过自己修改方法来替代(不建议):

<?phpfunction func_new_count($array_or_countable,$mode = COUNT_NORMAL){if(is_array($array_or_countable) || is_object($array_or_countable)){return count($array_or_countable, $mode);}else{return 0;}}

[3]create_function被废弃,可以用匿名函数来代替:
之前版本写法:

<?php$newfunc = create_function('$a,$b', 'return "ln($a) + ln($b) = " . log($a * $b);');echo "New anonymous function: $newfunc\n";echo $newfunc(2, M_E) . "\n";// outputs// New anonymous function: lambda_1// ln(2) + ln(2.718281828459) = 1.6931471805599
// Warning This function has been DEPRECATED as of PHP 7.2.0. Relying on this function is highly discouraged.

在7.2版本中会有警告提示,可修改为匿名函数来替代:

<?php$newfunc = function ($a,$b){return "ln($a) + ln($b) = " . log($a * $b);};echo $newfunc(2, M_E) . "\n";

vim /usr/share/wwwphp/ptcms/application/admin/controller/index.php
$zym_5 = M(‘user’)->count(null);
service nginx restart

! is_array(M(‘user’) )``

if(is_array(M(‘user’))){
$zym_5 = M(‘user’)->count();
} else {
$zym_5=0;
}

if(is_array(M('user'))){echo '变 是一个数组';  $zym_5 = M('user')->count();
} else {echo '变量no 是一个数组'; $zym_5=0;
} $this->sitenum = 1; $this->usernum = $zym_5; $this->adnum = 1; $this->friendlinknum =8;// count(C('friendlink'));

count(C(‘friendlink’));//输入2个友情链接后没有显示
怀疑该处统计有问题。
count()见D:\soft\php\wwwphp\ptcms\ptcms\driver\db\dao.php
C()见D:\soft\php\wwwphp\ptcms\ptcms\function.php
echo C(‘friendlink’);
vim /usr/share/wwwphp/ptcms/ptcms/function.php
vim /usr/share/wwwphp/ptcms/ptcms/driver/db/dao.php
vim /usr/share/wwwphp/ptcms/application/common/config.php
通过echo调试

// ‘friendlink’=> ‘5’,

 'friendlink'=>
array (0 => '不分组',1 => '基本',2 => '数据库',3 => '显示',4 => '功能',5 => '开放登录',-1 => 'TKD',-2 => 'URL',-3 => '采集',),

在config.php中增加上面数组,数值为9,无报错

(4)利用filelocator工具集中修改mysql查询
mysql_query
D:\soft\php\wwwphp\ptcms\public\plugin\codemirror\php.js
D:\soft\php\wwwphp\ptcms\ptcms\driver\db\dao.php
没有找到明显的mysql_query,看到pdo 和dao文件,估计都进行封装。

3采集规则,对已有规则的编辑或修改,数据丢失

通过数据库更改规则允许添加新书后可以采集

D:/soft/php/wwwphp/ptcms/application/rule/view/collect_index.html
D:\soft\php\wwwphp\ptcms\application\rule\controller\manage.php
D:\soft\php\wwwphp\ptcms\application\rule\view\collect_add.html
D:\soft\php\wwwphp\ptcms\application\rule\view\collect_edit.html

    http://192.168.0.104/admin.php //header('location:index.php?m=admin');//index.php   include dirname(__FILE__).'/ptcms/ptcms.php';//        __FILE__     返回当前 路径+文件名//     dirname(__FILE__) 返回当前文件路径的 路径部分 (后面没有“\”号)//     dirname(dirname(__FILE__));得到的是文件上一层目录名(不含最后一个“\”号)
//    D:\soft\php\wwwphp\ptcms\ptcms\ptcms.php$pt = new pt();$pt->start();PT_PATH . '/core/pt.php'  D:\soft\php\wwwphp\ptcms\ptcms\core\pt.php
public function start()//框架开始调用

vim全部删除 :%d

vim /usr/share/wwwphp/ptcms/application/rule/controller/manage.php
vim /usr/share/wwwphp/ptcms/ptcms/core/pt.phpprotected function app() {//加载控制器启动的插件$this->plugin->call('controller_start');//正常模式$controllerFile = APP_PATH . '/' . MODULE_NAME . '/controller/' .     CONTROLLER_NAME . '.php';$classname      = CONTROLLER_NAME . 'Controller';$actionname     = ACTION_NAME . 'Action';echo ',controllerFile ='.$controllerFile ;//得到程序具体的路径和执行文件echo ',classname='.$classname;echo ',actionname='.$actionname;

点“采集规则”
,controllerFile =/usr/share/wwwphp/ptcms/application/rule/controller/collect.php
,classname=collectController
,actionname=indexAction
采集规则 > 修改规则
,controllerFile =/usr/share/wwwphp/ptcms/application/rule/controller/collect.php
,classname=collectController
,actionname=editAction
小说管理 > 修改小说 这是正常的可以修改
,controllerFile =/usr/share/wwwphp/ptcms/application/novelsearch/controller/manage.php
,classname=manageController
,actionname=editAction
站点管理 > 修改站点
,controllerFile =/usr/share/wwwphp/ptcms/application/novelsearch/controller/site.php
,classname=siteController
,actionname=editAction

vim /usr/share/wwwphp/ptcms/application/rule/controller/collect.phppublic function editAction() { $this->id = I('request.id', 'int', 0); if (IS_POST) { if ($this->model->edit($_POST, ['id' => $this->id])) { $this->success('修改成功', U('test', array('id' => $_POST['id']))); } else { $this->error('修改失败', $this->model->geterror()); } } $this->sitelist = M('novelsearch_site')->where(array('status' => 1))->order('id asc')->getfield('id,name', true); $this->display(); } vim全部删除 :%d

根据this−&gt;model−&gt;edit(this-&gt;model-&gt;edit(this−>model−>edit(_POST, [‘id’ => $this->id])) 找到
D:\soft\php\wwwphp\ptcms\application\rule\model\rule.php

https://www.kuaiyankanshu.net/application/rule/view/collect_edit.html
https://www.kuaiyankanshu.net/application/rule/view/collect_angularjs.html
https://www.kuaiyankanshu.net/application/rule/view/collect_add.html

https://www.kuaiyankanshu.net/public/script/angular.init.js
https://www.haxxs.cc/application/rule/view/collect_angularjs.html
https://www.haxxs.cc/application/rule/view/collect_edit.html

D:\soft\php\wwwphp\ptcms\ptcms\core\model.php
D:\soft\php\wwwphp\ptcms\ptcms\core\base.php

    vim /usr/share/wwwphp/ptcms/ptcms/core/model.php
echo 'db($name);'.$this->db($name);echo ',db:'.$db;echo ',id:'.$id;echo ',field:'.$field;

列表显示与public function get没关系

DROP TABLE IF EXISTS `ptcms_rule`;CREATE TABLE `ptcms_rule` (`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,`name` varchar(50) NOT NULL DEFAULT '',`addnew` tinyint(3) unsigned NOT NULL DEFAULT '0',`newreplace` tinyint(3) unsigned NOT NULL DEFAULT '0',`collectallchapter` tinyint(3) unsigned NOT NULL DEFAULT '0',`dirsort` tinyint(3) unsigned NOT NULL DEFAULT '0',`siteid` smallint(5) unsigned NOT NULL DEFAULT '0',`url_list` text NOT NULL,`url_info` text NOT NULL,`url_dir` text NOT NULL,`list_novelid` text NOT NULL,`list_novelname` text NOT NULL,`list_lastid` text NOT NULL,`info_novelname` text NOT NULL,`info_author` text NOT NULL,`info_category` text NOT NULL,`info_intro` text NOT NULL,`info_cover` text NOT NULL,`info_isover` text NOT NULL,`dir_chapterid` text NOT NULL,`dir_chaptername` text NOT NULL,`dir_chapterurl` text NOT NULL,`chapter_api` text NOT NULL,`chapter_content` text NOT NULL,`create_user_id` int(11) unsigned DEFAULT '0' COMMENT '创建人',`update_user_id` int(11) unsigned DEFAULT '0' COMMENT '修改人',`create_time` int(11) unsigned DEFAULT '0' COMMENT '创建时间',`update_time` int(11) unsigned DEFAULT '0' COMMENT '修改时间',PRIMARY KEY (`id`)
) ENGINE=myisam DEFAULT CHARSET=utf8;
/index.php?s=rule/collect/ajax/id/35
<br />
<b>Deprecated</b>:  The each() function is deprecated. This message will be suppressed on further calls in <b>/usr/share/wwwphp/ptcms/ptcms/core/dispatcher.php</b> on line <b>55</b><br />
,controllerFile =/usr/share/wwwphp/ptcms/application/rule/controller/collect.php,classname=collectController,actionname=ajaxAction{"id": "35","name": "起点中文主站vip","discardstartnum": "0","discardendnum": "0","addnew": "1","newreplace": "0","collectallchapter": "1","dirsort": "0","siteid": "9","url_list": {"charset": "utf-8","error": "","rule": "http:\/\/app.api.ptcms.com\/api\/rule\/getlist.xml?site=qidian","replace": []},"url_info": {"charset": "utf-8","error": "","rule": "http:\/\/app.api.ptcms.com\/api\/rule\/getinfo.xml?site=qidian&novelid=[novelid]","replace": []},"url_dir": {"charset": "utf-8","error": "","rule": "http:\/\/app.api.ptcms.com\/api\/rule\/getdir.xml?site=qidian&novelid=[novelid]","replace": []},"list_novelid": {"singleline": 0,"ignorecase": "","rule": "<novelid>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/novelid>","replace": []},"list_novelname": {"singleline": 0,"ignorecase": "","rule": "<novelname>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/novelname>","replace": []},"list_lastid": {"singleline": 0,"ignorecase": "","rule": "<chapterid>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/chapterid>","replace": []},"info_novelname": {"singleline": 0,"ignorecase": "","rule": "<novelname>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/novelname>","replace": []},"info_author": {"singleline": 0,"ignorecase": "","rule": "<author>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/author>","replace": []},"info_category": {"singleline": 0,"ignorecase": "","rule": "<category>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/category>","replace": []},"info_intro": {"singleline": 0,"ignorecase": "","rule": "<intro>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/intro>","replace": []},"info_cover": {"singleline": 0,"ignorecase": "","rule": "<cover>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/cover>","replace": []},"info_isover": {"singleline": 0,"ignorecase": "","rule": "<isover>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/isover>","replace": []},"dir_chapterid": {"singleline": 0,"ignorecase": "","rule": "<chapterid>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/chapterid>","replace": []},"dir_chaptername": {"singleline": 0,"ignorecase": "","rule": "<chaptername>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/chaptername>","replace": []},"dir_chapterurl": {"charset": "auto","error": "","rule": "<chapterurl>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/chapterurl>","replace": []},"chapter_api": {"charset": "utf-8","error": "","rule": "http:\/\/app.api.ptcms.com\/api\/chapter\/get.xml?url=[url]","replace": []},"chapter_content": {"singleline": 0,"ignorecase": "","rule": "<content>(?:\\<\\!\\[CDATA\\[)?[内容](?:\\]\\]\\>)?<\/content>","replace": []},"create_user_id": "1","update_user_id": "1","create_time": "1415431945","update_time": "1448958911"
}

从上面可以看到,ajax取到数据。下面的脚本。没有把数据显示出来。

 vim /usr/share/wwwphp/ptcms/application/rule/view/collect_edit.html
<script type="text/javascript">function getrule() {var rule = [];$.ajax({url: '__URL__/ajax/id/{$id}',type: 'POST',//   data: {name:$("#name").val()},dataType: 'json',async: false,success: function (res) {rule = res;}});console.log("The :", rule);rule.name = 'ceshi';return rule;}
</script>
vim /usr/share/wwwphp/ptcms/application/rule/view/collect_angularjs.html
console.trace();console.log("测试1");console.log(rule);var result=eval("("+data+")");alert(result);var re = res.data;error:function(res){
alert("出错,出错信息为:”"+res);
}

success: function (res)未执行

把 dataType: ‘json’,改为 dataType: ‘text’,
success: function (res)执行,得到数据,但是还是不显示
问题,所显示数据{}前有一段html代码
controllerFile =/usr/share/wwwphp/ptcms/application/rule/controller/collect.php
,classname=collectController,actionname=ajaxAction

D:\soft\php\wwwphp\ptcms\application\rule\model\rule.php

vim /usr/share/wwwphp/ptcms/application/rule/model/rule.php
public function geteditinfo($zym_16)
{ $zym_20 = $this->where(array(‘id’ => zym16))−&gt;find();foreach(zym_16))-&gt;find(); foreach (zym1​6))−>find();foreach(zym_20 as KaTeX parse error: Expected 'EOF', got '&' at position 11: zym_13 => &̲zym_23)
{ if (strpos($zym_23, ‘[’) !== false && $zym_23{0} == ‘{’)
{ zym23=jsondecode(zym_23 = json_decode(zym2​3=jsond​ecode(zym_23, true);
}
}
return $zym_20;
}

vim /usr/share/wwwphp/ptcms/application/rule/controller/collect.php

D:\soft\php\wwwphp\ptcms\application\rule\controller\collect.php
class CollectController extends AdminController
D:\soft\php\wwwphp\ptcms\application\common\controller\admin.php
class AdminController extends Controller
D:\soft\php\wwwphp\ptcms\ptcms\core\controller.php
public function ajax($data, $type = ‘json’)

D:\soft\php\wwwphp\ptcms\ptcms\core\dispatcher.php
The each() function is deprecated. This message will be suppressed on further calls in /usr/share/wwwphp/ptcms/ptcms/core/dispatcher.php

vim /usr/share/wwwphp/ptcms/ptcms/core/dispatcher.php// 解析超级变量public function parseSuperVar() {if (strpos($_GET['s'], '.')) {$param = explode('.', $_GET['s'], 2);$_GET['f'] = $param['1'];$param = explode('/', $param['0']);} else {$param = explode('/', $_GET['s']);}$var['m'] = isset($param['0']) ? array_shift($param) : $this->config->get('default_module', 'index');$var['c'] = isset($param['0']) ? array_shift($param) : $this->config->get('default_controller', 'index');$var['a'] = isset($param['0']) ? array_shift($param) : $this->config->get('default_action', 'index');while ($k = each($param)) {$var[$k['value']] = current($param);next($param);};$_GET = array_merge($var, $_GET);}function func_new_each(&$array){$res = array();$key = key($array);if($key !== null){next($array); $res[1] = $res['value'] = $array[$key];$res[0] = $res['key'] = $key;}else{$res = false;}return $res;}

function func_new_each(&$array)放在上面报错,移到
D:\soft\php\wwwphp\ptcms\ptcms\function.php
vim /usr/share/wwwphp/ptcms/ptcms/function.php

each()错误解决!

[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/ptcms/core/dispatcher.php
[root@bogon gumu]# service nginx restart
Redirecting to /bin/systemctl restart nginx.service
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/ptcms/core/dispatcher.php
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/ptcms/function.php
[root@bogon gumu]# service nginx restart
Redirecting to /bin/systemctl restart nginx.service
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/application/rule/view/collect_edit.html
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/application/rule/model/rule.php
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/application/rule/controller/collect.php
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/ptcms/core/controller.php
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/ptcms/core/response.php

数组不能用 echo 来输出,
解决办法:print_r() 来输出数组,解决办法:var_dump() 来查看数据类型

   D:\soft\php\wwwphp\ptcms\ptcms\core\response.php
public function setHeader($mimeType = 'text/html') {if ($this->config->get('gzip_encode', false)) {$zlib = ini_get('zlib.output_compression');if (empty($zlib)) ob_start('ob_gzhandler');}if (!headers_sent()) {//设置系统的输出字符为utf-8header("Content-Type: $mimeType; charset=utf-8");//支持页面回跳header("Cache-control: private");//版权标识header("X-Powered-By: PTcms Studio (www.ptcms.com)");// 跨域if (strpos($mimeType, 'json')) {header('Access-Control-Allow-Origin:*');header('Access-Control-Allow-Headers:accept, content-type');}}}public function setBody($content = '', $mimeType = 'text/html') {if (!headers_sent()) {$this->setHeader($mimeType);}echo $content;}[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/application/rule/view/collect_edit.html
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/ptcms/core/controller.php
[root@bogon gumu]# service nginx restart

header(‘Content-type:text/json’); //这句是重点,它告诉接收数据的对象此页面输出的是json数据;

vim /usr/share/wwwphp/ptcms/ptcms/core/response.phpvim /usr/share/wwwphp/ptcms/ptcms/core/controller.php//$this->response->setBody($data, 'application/json');
$this->response->setBody($data, 'text/json');

header(“Access-Control-Allow-Origin:*”);
header(‘Access-Control-Allow-Headers:x-requested-with,content-type’);

PHP用ajax的时候,responseText返回的是整个页面的html代码

strpos(str,′a’);//字符串a在str,'a’);//字符串a 在str,′a’);//字符串a在str 第一次出现的位置 索引0开始 没有出现返回false 区分大小写
stripos($str,'a’);//同上 但是不区分大小写

最终结果发现,echo继承了父页的echo,把所以前面的测试echo去掉,发现一切正常

[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/ptcms/core/response.php
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/ptcms/core/controller.php
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/application/rule/model/rule.php
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/application/rule/controller/collect.php
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/ptcms/function.php
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/ptcms/core/model.php
[root@bogon gumu]# vim  /usr/share/wwwphp/ptcms/application/admin/controller/index.php
[root@bogon gumu]#  vim /usr/share/wwwphp/ptcms/application/rule/controller/manage.php
[root@bogon gumu]#  vim /usr/share/wwwphp/ptcms/ptcms/core/pt.php
[root@bogon gumu]# service nginx restart
Redirecting to /bin/systemctl restart nginx.service
[root@bogon gumu]# vim /usr/share/wwwphp/ptcms/application/rule/view/collect_edit.html
[root@bogon gumu]# service nginx restart

特别是vim /usr/share/wwwphp/ptcms/ptcms/core/pt.php中

protected function app() {//加载控制器启动的插件$this->plugin->call('controller_start');//正常模式$controllerFile = APP_PATH . '/' . MODULE_NAME . '/controller/' . CONTROLLER_NAME . '.php';$classname      = CONTROLLER_NAME . 'Controller';$actionname     = ACTION_NAME . 'Action';
//      echo ',controllerFile ='.$controllerFile ;
//      echo ',classname='.$classname;
//      echo ',actionname='.$actionname;if (MODULE_NAME == 'plugin') {//插件控制器$controllerFile = APP_PATH . '/common/plugin/' . CONTROLLER_NAME . '/manage.php';$classname      = 'manageController';$actionname     = ACTION_NAME . 'Action';} elseif (!in_array(MODULE_NAME, explode(',', $this->config->get('allow_module', '')))) {$this->response->error(MODULE_NAME . '模块不允许访问');}if (is_file($controllerFile)) {include $controllerFile;if (class_exists($classname, false)) {/* @var $app PT_Controller */$app = new $classname();//加载init方法if (method_exists($app, 'init')) {$app->init();}// 加载actionif (method_exists($app, $actionname)) {

清空数据,重新采集

Ptcms在php7.2.10下的调试,each等方法相关推荐

  1. Ptcms在php7.2.10下的采集调试

    1.重新采集后章节和目录报错 2018/10/3 Warning: Invalid argument supplied for foreach() in /usr/share/wwwphp/ptcms ...

  2. Windows 10 下的高效抓屏方法

    概述   很多软件都需要屏幕捕捉功能,在软件中实现屏幕捕捉也不是难事,在微软Windows平台,有很多截屏的方法,例如:BitBlt.Mirror driver. GDI hook.DirectX.D ...

  3. 在Windows下开发调试PySpark

    Spark版本:2.4.0+cdh6.3.1 Spark-Windows版本:spark-2.4.0-bin-hadoop2.7 WinUtils版本:hadoop-2.7.1 Python版本:3. ...

  4. 解决雷电模拟器在windows 10下无法桥接网卡的问题

    https://www.ldmnq.com/forum/thread-60719-1-1.html https://www.renyiwei.com/archives/1947.html 解决雷电模拟 ...

  5. mysql5.1编译安装centos7_CentOS7下 Nginx1.13.5 + PHP7.1.10 + MySQL5.7.19 源码编译安装

    在CentOS7下 Nginx1.13.5 + PHP7.1.10 + MySQL5.7.19 源码编译安装过程记录. 一.安装Nginx 1.安装依赖扩展 # yum -y install wget ...

  6. linux php环境升级,php5.6升级到php7.1.10(Linux环境)

    环境说明:nginx+php 无需删除旧的php5版本,升级步骤如下: 0.,关闭php-fpm(如果有) service php-fpm stop 1.拉取php7.1.10 tar包 $wget ...

  7. iis7.5 php7.0,(原创)win7自带IIS7.5+php7.0.10安装教程(图)

    php在上周8月18日发布了PHP 7.0 (7.0.10)版本.详细下载页面http://windows.php.net/download/,根据自身电脑配置情况酌情下载版本.win7旗舰版,iis ...

  8. 编译安装Centos7.2+Apache2.4.25+PHP7.2.10+Mysql5.6.16

    一.编译部署Apache2.4.25 1.环境准备 #设置或停止防火墙: [root@localhost ~]# systemctl stop firewalld.service [root@loca ...

  9. 命令行下 pdb 调试 Python 程序

    官方参考网站 The Python Debugger : https://docs.python.org/3/library/pdb.html gdb 调试命令的使用及总结:https://blog. ...

最新文章

  1. R语言与数据分析(9)R与Excel
  2. Linux_LVM、RAID_RHEL7
  3. 我去,JS自执行匿名函数竟然有20几种写法!
  4. mysql堵塞 sending data和sort状态多,cpu高
  5. 操作篇 ###rip协议学习和理解##
  6. usaco3.33Camelot(BFS)
  7. matlab 置顶曲线,matlab figure 最大,最小,置顶
  8. 学习web前端,合理的学习路线,如何成为一个合格的前端工程师
  9. 米范 - 为新媒体和电商从业者提供的酷导航
  10. [转载] python 调用自己的方法报错,numpy.ndarray object has no attribute brighten
  11. 【git】常用命令行收集
  12. seaborn 绘图sns.relplot
  13. matlab工具箱安装
  14. Vue的8种通信方式
  15. 注意int类型数据相加的溢出
  16. iOS/Android 微信及浏览器中唤起本地APP
  17. 灵遁者句子:意识从物质诞生那一刻起,就诞生了
  18. 活动推荐 | Google、Facebook、Twitter一线大牛和你一起聊AI
  19. word标题段前断后设置都为6磅,标题段前无效
  20. Pytorch中的repeat以及repeat_interleave用法

热门文章

  1. 《C陷阱与缺陷》----词法“陷阱”
  2. Silverlight 4.0 Demo
  3. 深入学习Android
  4. Linux环境下Anaconda3安装配置pytorch
  5. 网站友链有用吗?怎么交换?注意事项?
  6. Deep Learning with Python 读书笔记6.26 I 什么是深度学习
  7. linux virt-manager vncserver 安装
  8. spring boot前端
  9. 有一门课不及格的学生
  10. 虚拟机linux系统启动时显示cannot mount filesystem Invalid argument