首页 Soft PlugIn RAN乱 Dev开发 Info资料 English WAP 留言 登陆 注册
-
Posted by Yippee | 评论(0) | 引用(0) | 阅读1875次
iwas6-MVC STRRPOS

iwas的源代码INDEX.PHP处理所有的操作,和我平时的编程习惯不一致,觉得比较别扭,我不是很习惯一个大文件,上网找了找MVC分层的资料,感觉不错

用PHP开始你的MVC (一)整合你的站点入口
/*
     * 解析当前的访问路径,得到要进行动作
     */
    function _parsePath(){
     list($path, $param) = explode("?", $_SERVER["REQUEST_URI"]);
        $pos = strrpos($path, "/");
        $this->action = substr($path, $pos+1);
    }

我改为:

list($path, $param) = explode("?", $_SERVER["REQUEST_URI"]);
     $pos = strrpos($param, "=");
        $m=substr($param, $pos+1);

我一直使用正常,http://http://127.0.0.1/iwas/?action=img_show
但是现在有一个解析不正常了:http://127.0.0.1/iwas/?action=img_del&id=0&name=1124846170.bmp

看来看去,原来是 strrpos?!
strpos --  Find position of first occurrence of a string
int strpos ( string haystack, mixed needle [, int offset] )
Returns the numeric position of the first occurrence of needle in the haystack string. Unlike the strrpos(), this function can take a full string as the needle parameter and the entire string will be used.

strrpos --  Find position of last occurrence of a char in a string
int strrpos ( string haystack, string needle [, int offset] )
Returns the numeric position of the last occurrence of needle in the haystack string. Note that the needle in this case can only be a single character in PHP 4. If a string is passed as the needle, then only the first character of that string will be used.


最后索性改为 $this->action=$action; 了事


2005-8-24 8:36:33 已删除  SF\shengfang GreenBrowser.ex M:\temp\Temporary Internet Files\Temporary Internet Files\Content.IE5\7Q2W3FJM\server[1].htm Exploit-MhtRedir.gen (特洛伊)
2005-8-24 8:36:33 已删除  SF\shengfang GreenBrowser.ex M:\temp\Temporary Internet Files\Temporary Internet Files\Content.IE5\7Q2W3FJM\ok[1].htm JS/Exploit-HelpXSite (特洛伊)
2005-8-24 8:36:33 已删除  SF\shengfang GreenBrowser.ex M:\temp\Temporary Internet Files\Temporary Internet Files\Content.IE5\KLTAFHVX\ok[1].htm JS/Exploit-HelpXSite (特洛伊)
2005-8-24 8:36:34 已清除  SF\shengfang GreenBrowser.ex M:\temp\Temporary Internet Files\Temporary Internet Files\Content.IE5\ALZW9GJE\hua[1].exe W32/Darro.gen (病毒)
2005-8-24 9:46:48 移动失败(清除失败)  SF\shengfang msvb_default.ex M:\temp\Temporary Internet Files\Temporary Internet Files\Content.IE5\6QY99H0I\ins_33ng[1].exe Proxy-Agent.a.dr (特洛伊)

vig0
11-Jul-2005 09:03
This function takes in a string and a delimiter. It then builds an array of the data in between the delimiter then returns the array. I needed this function for something that I'm doing and thought it was somewhat useful.

function multiStrposArray($haystack, $needle){
  $array = array();
  $row  = 0;
  $var  = "";
  for ($i=0; $i<strlen($haystack); $i++) {
   if (substr($haystack, $i, 1)==$needle) {
     $array[$row] = $var;
     $row++;
     $var = "";
   } else {
     $var .= substr($haystack, $i, 1);
   }

  }
  if ($var) $array[$row] = $var;
  return $array;
}


字体:

Permanant URI永久地址 http://www.shengfang.org/blog/p/IWAS5MVCSTRPOS.php
Trackback URI引用地址 http://www.shengfang.org/blog/tb.php?tb_id=1124848074

2005年8月24日09:47星期三  [Dev开发] 追踪此文的RSS
提示:
此文还没有评论。

称呼:    登陆   注册
   不注册,但记住我的信息
邮件:
(非必须)
评论: [UBB代码帮助]
粗体 斜体 下划线 链接 水平线 引用



验证码: 请输入你看见的数字
关闭UBB      提交时自动将内容复制到剪贴板

公告





统计信息
[Yippee]||[统计]||日志:2143
在线: 8||用户: 2635 [列表]
今日:746||到访:3654531
Rss:||评论:1668

最新日志

最新评论

友情链接

日历
342009 - 0734
   1234
567891011
12131415161718
19202122232425
262728293031 

最新引用
搜索

归档

杂项
Get RSS Feed (Version 2.0)
Get Atom Feed (Version 0.3)
编码:  UTF-8