yinzhili 发表于 2009-8-17 08:41:38

是的,Windows下当然可以使用.htaccess,这是与平台无关的。

Hex 发表于 2009-8-17 10:22:37



把view中所有的base_url()换成site_url()会使得js和CSS脚本找不到啊?
还有换成site_url()后,会出现像localhost/bookstore/index.phpsearch 这样缺少一个斜杠的情况,有没更好的解决方案?
或者能直接在windows上 ...
alexdiao 发表于 2009-8-16 21:39 http://codeigniter.org.cn/forums/images/common/back.gif
js 和 css 等需要用 base_url()
访问 index.php/xxxx/xxx 需要用 site_url()
出现少斜杠,是因为 config.php 中的 base_url 缺少斜杠。

yinzhili 发表于 2009-8-17 11:49:45

比方说你在 config.php 里面设置的base_url是 http://localhost/shop/,index_page为 index.php,那么你用site_url()函数返回的值就是 http://localhost/shop/index.php,而用base_url()函数返回的值就是
http://localhost/shop/
如果你将config.php里面的index_page设置为空,并且使用.htaccess去掉了URL中的index.php,那么这两个函数的返回值是一样的。
到底使用哪个函数,要根据实际情况来决定。

alexdiao 发表于 2009-8-17 15:14:12

比方说你在 config.php 里面设置的base_url是 http://localhost/shop/,index_page为 index.php,那么你用site_url()函数返回的值就是 http://localhost/shop/index.php,而用base_url()函数返回的值就是
http://loc ...
yinzhili 发表于 2009-8-17 11:49 http://codeigniter.org.cn/forums/images/common/back.gif

我昨天尝试过把base_url后面加斜杠,但是site_url()出来还是差个斜杠。
今天我保留.htaccess,做了些配置就可以了。
第一次接触url重写,记个笔记给以后要在windows上配置这个项目,希望保留url重写的人:
1.修改apache的httpd.conf中:
将 LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so
或LoadModule rewrite_module lib/apache2/modules/mod_rewrite.so
前面的井号去掉,并且:
AllowOverride None 改为 AllowOverride ALL
2.如果你的项目名未使用作者的默认名CI,需要修改.htaccess中/CI/index.php/ 改为比如/bookstore3/index.php/
3.配置config.php 和database.php并导入相应数据。
yinzhili你程序写的不错,谢谢了!

tringleyoung 发表于 2009-8-17 17:41:44

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\bookstore\system\codeigniter\Common.php on line 130

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\bookstore\system\codeigniter\Common.php on line 136

A PHP Error was encountered
Severity: 8192

Message: Function set_magic_quotes_runtime() is deprecated

Filename: codeigniter/CodeIgniter.php

Line Number: 60

A PHP Error was encountered
Severity: 8192

Message: Assigning the return value of new by reference is deprecated

Filename: libraries/Loader.php

Line Number: 255

A PHP Error was encountered
Severity: 8192

Message: Assigning the return value of new by reference is deprecated

Filename: database/DB.php

Line Number: 133

A PHP Error was encountered
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\bookstore\system\codeigniter\Common.php:130)

Filename: libraries/Session.php

Line Number: 408

A PHP Error was encountered
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\bookstore\system\codeigniter\Common.php:130)

Filename: libraries/Session.php

Line Number: 662



这个是什么回事啊

Hex 发表于 2009-8-17 19:07:39

CI 1.7.1 不支持 PHP 5.3
请等待 1.7.2,将支持 PHP5.3

tringleyoung 发表于 2009-9-2 11:14:07

这个后来我也清楚了。当时就时搞不清楚,让我心里累死了

sinopf 发表于 2009-9-2 12:35:22

我也是初学者,基本上不懂,大致看了一下,楼主的代码总体还是很不错的,不过没有严格遵循MVC,有的V代码跑到C里边了。

wangjialei 发表于 2009-9-4 12:20:12

文件是uft8编码的,好像有BOM,总是出session_start()的warning,我把文件转成没有bom的,session_start()的warning没有了,可是


文件中,像

echo "<script language='JavaScript'>alert('sorry,you can't login,because there's not this username');history.back();</script>";

这样的输出'JavaScript'的代码都运行不了乐,怎么回事呀,99

Hex 发表于 2009-9-4 12:47:44

那没办法,必须先输出 HTTP 头,这是规定,你只能自己想办法改进程序结构。
页: 1 2 [3] 4 5 6 7 8 9 10 11
查看完整版本: 我的毕业设计——用CI做的网上书店系统