熟悉php框架CodeIgnitor的进来看看,怎么在view文件中加载js文件

WBOY
Release: 2016-06-06 20:42:12
Original
1224 people have browsed it

想在view视图文件中加载一个jquery文件,使用相对路径显示文件无法找到,使用绝对路径显示403禁止访问,但是在dreamwaver中文件就能加载,不知道这个文件要怎么才能加载呢?熟悉php框架CodeIgnitor的进来看看,怎么在view文件中加载js文件

熟悉php框架CodeIgnitor的进来看看,怎么在view文件中加载js文件

熟悉php框架CodeIgnitor的进来看看,怎么在view文件中加载js文件

回复内容:

想在view视图文件中加载一个jquery文件,使用相对路径显示文件无法找到,使用绝对路径显示403禁止访问,但是在dreamwaver中文件就能加载,不知道这个文件要怎么才能加载呢?熟悉php框架CodeIgnitor的进来看看,怎么在view文件中加载js文件

熟悉php框架CodeIgnitor的进来看看,怎么在view文件中加载js文件

熟悉php框架CodeIgnitor的进来看看,怎么在view文件中加载js文件

一般静态文件全部放在根目录下面 , 你可以使用 site_url() ; ."/js/jquery.js" 这种方式进行加载

如果JS存放在/static/js/jquery.js CI中有site_url函数,可以返回网站地址,拼接一下就行了。

1.dreamware是一个软件,codeigniter是一个php框架,两者不沾边。
2.在网站根目录放置js文件夹,然后写script标签的

<code>src="<?php echo base_url();?>js/jquery.js"
</code>
Copy after login

谢谢大家回答,原因是application目录有一个.htaccess文件,里面有一句Deny from all,所以无法加载,转到根目录就可以了

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!