如果没有Codeigniter路由(Codeigniter routing if not)
我想配置像这样的codeigniter路由
这很好用
$route['login/(:any)'] = "login/index/$1"; $route['profile/(:any)'] = "profile/index/$1";
但我想这样做,如果不是=登录或个人资料,那么我想这样做
$route['not(login or profile)'] = "home/index/$1";
这段代码不对,请帮我给我代码。
我有3个控制器他们是1.家2.配置文件3.登录
现在如果我使用这个domain.com/profile然后我想运行配置文件控制器,如果我去domain.com/profile/john我需要从我的控制器domain.com/profile/john/edit我得到这个名字john还需要从控制器获取此john并进行编辑 。
现在,如果我顺其自然
domain.com/login
然后我想运行配置文件控制器,如果我去
domain.com/login/best
我需要从我的控制器中获得最佳名称
domain.com/login/best/sure
我还需要从控制器那里得到最好的和最好的 。
如果我一起去
domain.com/ or domain.com/bestoffer or domain.com/others or domain.com/blabla
没有配置文件和登录域后的任何事情我需要运行家庭控制器
就这样
I want to configure codeigniter routing something like this
This is working good
$route['login/(:any)'] = "login/index/$1"; $route['profile/(:any)'] = "profile/index/$1";
But i want to do this if not = login or profile then i want to do this
$route['not(login or profile)'] = "home/index/$1";
This code is not right so please help me by give me code for this.
i have 3 controller they are 1. home 2. profile 3. login
Now if i go with this domain.com/profile then i want run profile controller, and if i go with domain.com/profile/john i need go get this name john from my controller domain.com/profile/john/edit i also need to get this john and edit from controller.
Now if i go with this
domain.com/login
then i want run profile controller, and if i go with
domain.com/login/best
i need go get this name best from my controller
domain.com/login/best/sure
i also need to get this best and sure from controller.
And if i go with
domain.com/ or domain.com/bestoffer or domain.com/others or domain.com/blabla
anything after domain without profile and login i need to run Home controller
That's all
原文:https://stackoverflow.com/questions/40282639
相关问答
更多-
"yearmon"和"yearqtr"类表示日期为年份+分数,因此: as.year <- function(x) as.integer(as.yearmon(x)) 还要注意这个结构: diff(x, arithmetic = FALSE) - 1 "yearmon" and "yearqtr" classes represent dates as year + fraction so: as.year <- function(x) as.integer(as.yearmon(x)) Also not ...
-
熊猫:计算每月收集的房屋销售的半年平均值(Pandas: Compute the half-yearly average of monthly collected house sales)[2023-03-20]
考虑使用熊猫resample的封闭参数来决定: 垃圾箱的哪一侧关闭 下面使用left 6个月的截止日期是6/30 and 12/31而不是1/1 and 7/1产生2000的值: mdf = tdf[sel_cols].T.resample('6M', closed='left').mean().T.rename( columns=lambda x: '{:}${:}'.format(x.year, [1, 2][x.quarter > 2])) mdf[df.columns[:6]] = df[ ... -
如果我正确理解您的代码,当您这样做时: subseries = series['2015-07-07 01:00:00':'2015-07-07 03:30:00'] 你从两个字符串切片series (顺便说一句,这看起来很混乱,因为有一个pandas数据类型Series )。 如果有效,那么从subseries= df[d:f]你需要的是d和f是字符串。 你可以通过调用datetime方法.strftime()来做到这一点,例如: d= GetDatetime().strftime('%Y-%m-%d ...
-
大熊猫每年转换为月度(Pandas convert yearly to monthly)[2024-01-12]
你想要resample 首先,您需要设置索引以便resample 。 然后回填并重置索引。 df.set_index('date').resample('M').bfill().reset_index() date ticker value 0 1999-12-31 ECB/RA6 1.0 1 2000-01-31 ECB/RA6 4.0 2 2000-02-29 ECB/RA6 4.0 3 2000-03-31 ECB/RA6 4.0 4 ... -
您可以使用属于SQL-99 ANSI标准"windowing functions" LAG()函数 : select article_id, section, time, num_views, comments, lag(num_views, 1, 0) over(partition by article_id order by article_id, time) as lag1, lag(num_views, 2, 0) over(partition by article_id order b ...
-
大熊猫系列累积argmax(pandas series cumulative argmax)[2022-11-16]
你不需要cumargmax功能。 相反,你可以在一行中做到这一点, pd.expanding_apply(series, lambda x: x.argmax()) pandas 0.18正在弃用expanding_apply()模块级功能。 他们正在用以下方法调用替换, series.expanding().apply(lambda x: x.argmax()) 查看http://pandas.pydata.org/pandas-docs/stable/computation.html上的文档 You ... -
有function返回pd.Series而不是。 返回列表正在尝试将列表放入现有行。 返回pd.Series说服了不同的大熊猫。 def function(row): return pd.Series([row.A, row.A/2]) df2 = pd.DataFrame({'A' : np.random.randn(8), 'B' : pd.date_range('1/1/2011', periods=8, freq='H'), ...
-
xts endpoints函数可以与R或dplyr base一起使用来计算月回报。 这两个版本是: # Use xts and base R library(xts) q2 <- within(q1[endpoints(q1$Date, on="months"),], Return <- ave(Price, Firm, FUN=function(x) c(NA, (diff(x)/head(x,-1)))))[,c("Date", "Firm", "Return") ...
-
使用带有pandas DF系列的datetime timedelta(Using datetime timedelta with a series in a pandas DF)[2022-10-25]
这个怎么样? start = dt.datetime.now() sim_df['date'] = start + sim_df['cum_days'].map(dt.timedelta) 这将dt.timedelta分别应用于dt.timedelta列的每个元素。 How about this? start = dt.datetime.now() sim_df['date'] = start + sim_df['cum_days'].map(dt.timedelta) This applies dt. ... -
我得到我想要的工作方式是通过以下方式: 1)更改myfunction()函数以返回pd.Series(intermediate_df.unstack()) 因此,在将所需的数据帧转换为Series对象之前,请将其取消堆叠 2)将我对df.apply()调用更改为: df.apply(myfunction, args=(df2,x,y,z), axis=1).stack().reset_index(drop=True) 我遵循以下链接给出的关于如何从DataFrame创建Series目标的方向。 也许Pan ...