我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Codeigniter路由不使用正则表达式

I am trying to check if a url is in given format by using regular expression. this is my code.

myurl is : example.com/123456-watch-example_video_name

$route['([0-9]+)-[watch]-[A-Z0-9_+-]'] = 'mycontroller';

It is going to 404 page. Where I am wrong, i am new to regular expression.

Try the below:

$route['([0-9]+)-watch-[A-Z0-9_+-]+'] = 'mycontroller';

[watch] matches one char of watch, so remove [], and [A-Z0-9_+-] matches one char too, for one and more use [A-Z0-9_+-]+

近期文章

  • Mysql Update Query运行两次
  • 检索两个日期之间的不同小时数
  • AWS EC2 PHP(Ubuntu)需要10秒以上才能加载1页
  • PHP Google App Engine Charset UTF无法正常工作
  • 复杂的表单集合类型和事件在Symfony2中预先设置数据
  • 如何在特定键上合并两个多维数组(唯一键)
  • Laravel 4 One to Many with where
  • 数据库的就绪国家列表? [关闭]
  • 复选框以随机方式删除列表
  • 白屏使用mysqli
  • 将本地时间响应转换为1970年以来的秒数[关闭]
  • MySQL查询与族层次结构/布局相关
  • Laravel app:abort(404)没有显示404页面
  • 如何在Windows 8 x64上安装ImageMagick for PHP5.3 / 5.4
  • 使用Codeigniter编辑和删除操作
  • 每个复选框的多个值
  • 将文件复制到所有子目录php
  • 在同一页面重定向不起作用?
  • 检查会话数组是否有特定值
  • 捕获“死”错误并将其粘贴到原始页面上

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华