CodeIgniter with Socket.io,Err:无法加载资源

时间:2018-04-04 04:01:49

标签: php codeigniter socket.io livechat

设置

  • 操作系统:Windows
  • 浏览器:Chrome
  • socket.io版本:2.1.0
  • CodeIgniter:3

您好,我正在尝试将Web插槽中的教程包含到我的codeIgniter项目中。

但是,当我实现完全相同的方式时,我得到了错误"无法加载资源:... socket.io.js"

但是如果我尝试使用这个" localhost:3000 / socket.io / socket.io.js"来访问socket.io.js。它能够访问的URL。

由于codeigniter只会像这样运行url" localhost / ci_test / chat",有没有办法解决这个问题,或者有没有适当的教程将socket.io实现到CodeIgniter中?

提前致谢。

1 个答案:

答案 0 :(得分:0)

修正了这个问题: -

 /***This is a raw query which should be optimized using self joins***/     
 Select o.Program ,min(o.Term) AS StartTerm,
 min(o.year) AS StartYear,
 max(Term) AS EndTerm,
max(o.year) AS EndYear,
(Select max(g.year) from #GradProg g where g.[Grad term] = o.[Grad term] 
AND  g.Program = o.Program AND g.[Grad year] = o.[Grad year]) AS EndYear,
[Grad term],[Grad year]
,Iscontinous   
 from 
(
  Select *,
  case when (Select i.Program from #GradProg i where i.Term = t.nextterm and 
  i.Year = t.nexttermyear)  is not null then
   1
  when t.year = (Select max(y.Year) from #GradProg y) and t.Term = (Select 
  max(tm.Term) from #GradProg tm where t.Year = tm.Year)  then 
   1
 else
  0
 end as Iscontinous     
  from 

 (Select * ,

    case o1.Term when 3 then 1 
    else (o1.Term +1) 
    end as nextterm,
    case o1.Term when 3 then o1.Year + 1 
    else (o1.Year) 
    end as nexttermyear    
    from #GradProg o1

  )t
 )o
group by   o.Program ,o.[Grad term],o.[Grad year],
Iscontinous 
order by [Grad year] desc
/*********end *************/

并在显示页面修改套接字。

<script type='text/javascript' src='http://localhost:3000/socket.io/socket.io.js'></script>