您可以使用使用并比较两个表1 x 1的列来实现它。要比较tableone的tablewo,您需要使用加入,在此查询中,我使用左JOIN。
SELECT a.id, a.`uid`,
IF(a.`thingone`=1, b.`thingone`, NULL) AS thingone,
IF(a.`thingtwo`=1, b.`thingtwo`, NULL) AS thingtwo,
IF(a.`thingthree`=1, b.`thingthree`, NULL) AS thingthree FROM tableone a
LEFT JOIN tabletwo b ON uid=oid;
检查 mysql if()function function 以获取更多详细信息。
检查这是否与问题12850 /code>在合并请求管道中均为零”。
或问题28252 ci_merge_request_target_branch_sha
在分离的合并请求管道中“
尝试一个简单的测试,以查看您当前版本的gitlab:是否可以更好地工作:
image: node:8
test-ci-vars:
only:
- master
- merge_requests
script:
- echo CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME}
- echo CI_MERGE_REQUEST_SOURCE_BRANCH_SHA=${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}
- echo CI_MERGE_REQUEST_TARGET_BRANCH_SHA=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA}
- echo CI_MERGE_REQUEST_SOURCE_BRANCH_NAME=${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}
- echo CI_MERGE_REQUEST_TARGET_BRANCH_NAME=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
使用CSV文件时,您应该使用 pandas 图书馆。
但是,如果您想在平原的python中进行行,这是一种解决方案。
with open('containers.txt', 'r') as f:
with open('output.txt', 'w') as out:
for line in f:
if line: #skip empty lines
data = list(filter(None, map(lambda x: x.strip(), line.split('|')))) #one-liner to split the line in its data-fields and remove empty ones
if len(data) == 4: #if the Client is missing the len will be 3
client = line[:9] #save the Client field
out.write(line + '\n')
else:
out.write(f'{client}{line[9:]}\n') #use the saved Client field to fill in the gaps
输出文件现在包含:
|Client | Container weight | Country of Origin | Product code |
|S4378 | 450 Ton | China | 457841 |
|S4378 | 350 Ton | Japan | 457841 |
|S4378 | 900 Ton | Japan | 457841 |
|S4378 | 589 Ton | China | 457841 |
|S4978 | 1400 Ton | Mexico | 457841 |
|S4978 | 980 Ton | Emirates | 457841 |
|S4978 | 550 Ton | China | 457841 |
|S4578 | 450 Ton | China | 457841 |
您需要做两件事,以便您可以从浏览器中列出一个容器的内容:
第一:设置SAS以具有两个两个权限:读取和列表。如果仅添加读取权限,则无法列出容器的内容。
下一个:将两个附加的Querystring参数附加到您从浏览器中访问的URI:
- Restype = container
- comp = list,
因此您最终会得到类似的内容:
https://<acct>.blob.core.windows.net/<container>?restype=container&comp=list&sp=rl&st=2022-05-24T12:16:02Z&se=2022-05-24T20:16:02Z&spr=https&sv=2020-08-04&sr=c&sig=...
当服务器
在 app \ providers \ appServiceProvider.php
中使用HTTP时,您可以强迫应用程序在服务资产文件中使用HTTPS。
public function boot()
{
// Fix https
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$this->app['request']->server->set('HTTPS', true);
}
}
由于 dtype
arr
是布尔值,因此当您在该数组中进行分配时,它正在被施放以匹配 dtype
。您需要一个带有适当 dtype
的数组来执行此操作:
arr = arr.astype(np.float64)
arr[row, col] = 5.0
我认为不需要 ElementHTML
。
您只需通过搜索CSS选择器来使用 childris_element
。
...
driver_BV.get("https://www.qvc.com/handbags-and-luggage/handbags/clutches/_/N-1cknw/c.html?qq=mh")
product_BV=[]
price_BV=[]
Final=[]
children_element=driver_BV.find_elements_by_css_selector(".plContent .galleryItem")
它将找到60件商品。
之后,错误一直在发生,我认为您需要在循环中修复这些错误。
帐户B中的任何人都可以担任角色
否,那是不起作用的。在帐户B中,任何IAM实体(用户,角色)都希望访问该角色,仍然需要明确的IAM权限来执行此操作。
如果您只希望lambda担任该角色,则必须使用lambda executone角色:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "<arn-of-lambda-exec-role-from-acc-B-to-assume-the-role"
},
"Action": "sts:AssumeRole",
"Condition": {}
}
]
}
参考
堆栈溢出具有许多其他重要资源可以入门:
- serverfault:您想知道的有关mod_rewrite
的一切
(请记住要删除^/
.htaccess
usage的模式前缀。) - do and and and in mod_rewrite的隐藏功能。
- 浏览我们的最受欢迎的mod-rewrite 问题和答案。
- apache 重定向和重新映射和重新映射指南。
- askapache ultimate .htaccess Guide
- 和 mod-rewrite 。
甚至是新手友好的正则概述:
- 我们的标签Wiki 用于语法汇编。
- 和短 apache Regex摘要。
- else regexp.info 用于易于理解的基础。
经常使用的占位符
。*
匹配任何内容,甚至是一个空字符串。您不想在任何地方使用此模式,但通常是在最后一个后备规则中。-
[^/]+
更经常用于路径段。除了前锋斜线以外,它都与任何东西相匹配。 -
\ d+
仅与数字字符串匹配。 -
\ w+
匹配字母数字字符。它基本上是[A-ZA-Z0-9 _]
的速记。 -
[\ w \ - ]+
用于“ slug” - 式路径段,使用字母,数字,dash - 和_ <
- _ << /code> -
[\ w \ - 。,]+
添加时间和逗号。喜欢中的Escaped
charclasses。\ -
dash […] -
\。
表示字面时期。否则。
之外[…]
是任何符号的占位符。
这些占位符中的每一个通常都包裹在(…)
括号作为捕获组中。整个模式通常在^………$
开始 +结束标记中。引用“模式”是可选的。
重写
以下示例是以PHP为中心的,更易于增量,更容易适应类似情况。
它们只是摘要,通常链接到更多的变化或详细的Q&amp; AS。
-
静态映射
/contact
,将一些页面名称缩短到内部文件方案最简单:
重写 ^联系人$ templ/contact.html 重写 ^大约$ $ php
-
数字标识符
/object/123
将诸如
之类的快捷方式介绍http://example.com/article/531
也很容易。数字占位符只需重新命名$ _ get
参数:重新写入 ^actits/(\ d+)$ actity-show.php?id = $ 1 #└└└└邮编 - ─-─-─-─-─-─-─-─-─达队 - ─-─达队 - ─-─-─-─- - ┘
-
slug式占位符
/atrect/with some-title-slug
您可以轻松地扩展该规则以允许
/atrate/title-string
占位符:重新写入 ^Article/([\ w-]+)$ actity-show.php?title = $ 1 #└└└└届└└邮编 - ─-─-─达克 - ─达队 - ─达队 - ─..- - ─达队 - ─-─-─-─-─-─-─- - ┘
请注意,您的脚本 必须能够(或适应)将这些标题映射回数据库ID。单独的重写无法从稀薄的空气中创建或猜测信息。
-
带有数字前缀的slugs
/readable/123-plus-title
因此,您经常会看到混合
/atrate/529-title-slug
实践中使用的路径:重新写入 ^Article/(\ D+) - ([\ w-]+)$ action.php?id = $ 1&amp; title = $ 2 #└└└└─押期至前 - 达克 - ─-─-─-─-─-─-─-─-─杏仁 - ─-─-─-─-─-─-┘
现在,您可以跳过
title = $ 2
,因为无论如何您的脚本通常都依靠数据库ID。-title-slug
已成为任意URL装饰 -
带有替代列表的统一性
/foo/…
/bar/…
<代码>/baz/…如果您对多个虚拟页面路径有类似的规则,则可以使用
|
替代列表匹配并将其压缩。然后再次将它们重新分配到内部获取参数:###┌┌届┌┌€ - �I-────-─-─-─-─-─-─-─-─-─-─-─- - ┐ 重写 ^(博客| post |用户)/(\ w+)$ disp.php?type = $ 1&amp; id = $ 2 #└└└前往# - ─-─达克 - ─达克 - ─-─-─-─-─-─-─-─-─-─-─-─-─-─-─-─-─-─-─-
您可以将它们分为单个
重写
是否应该过于复杂。 -
将相关的URL派遣到不同的后端
/date/date/switch/backend
对替代列表的更实际使用是将请求路径映射到不同的脚本。例如,根据日期为较旧的Web应用程序提供统一的URL:
###┌┌┌届€─-€───杏仁 - ─-─-─-─-─-─-─-─-─-─-─-─-─-─-─-─-┐ #│││││┌┌届─-─-─-─-─-─-┼─- - ─-─-─-─-─-─-─-─-─-┐ 重写 ^blog/(2009 | 2010 | 2011)/([\ d-]+)/?$ old/blog.php?date = $ 2 重写 ^blog/(\ d+)/([\ d-]+)/?$ MODENAL/blog/index.php?start = $ 2 #└└└前往# - �—─-─达克 - ─-─-─-─-─达恩至─........................................─..-─..-─杏仁 - ─-─-─-─-─-─-─-┘
这只是将2009-2011的帖子帖子映射到一个脚本,所有其他年都隐含地贴在另一个处理程序上。
请注意更具体的规则首先。每个脚本可能使用不同的get参数。 -
其他定界符不仅仅是
/
路径斜线
/user-user-duse-123-name
您通常会看到重写以模拟虚拟目录结构。但是您并没有被迫不创造。您还可以使用
-
连字符进行分割或结构。重写 ^用户 - (\ d+)$ show.php?什么=用户&amp; id = $ 1 #└└└└─-─-─-─-─-─-─-─-─-─-─达队 - ─-─-─-─-─-─-─-─-┘ #这可以使用`(\ w+)`或者用于用户名而不是ID。
对于也常见的
/wiki:page_name
方案:重写 ^Wiki:(\ w+):(\ w+)$ wiki.php?sect = $ 1&amp; page = $ 2 #└└前达克 - ─-┼───-─-─-─-─-─-─-──达队 - ─-─-─- - ┘┘ #└└└└─-─-─-─-─-─-─-─-─-─达队 - ─..-─..- - ─达队 - ─-─-─- - ┘
有时,它适合在
/
-delimiters和之间交替:
或。
在同一规则中。或者再次有两个重写器将变体映射到不同的脚本。 -
可选尾声
/
slash
/dir
=/dir/dir/
选择目录风格的路径时,您可以在最终/
的情况下使其可达到
重写 ^blog/([\ w-]+)/?$ blog/show.php?id = $ 1 #┗┛
现在,这两个都可以处理
http://example.com/blog/123
和/blog/123/
。/?$
方法很容易附加到任何其他重写。 -
虚拟路径的灵活片段
。*/。*/。*/。*
大多数规则您会遇到映射一个约束的
/…/
资源路径段到个人获取参数的段。某些脚本处理可变数量的选项。
Apache Regexp引擎不允许将其任意数字选中。但是您可以轻松地将其扩展到规则块中:重写 ^(\ w+)/?$ in.php?a = $ 1 重写 ^(\ w+)/(\ w+)/?$ in.php?a = $ 1&amp; b = $ 2 重写 ^(\ w+)/(\ w+)/(\ w+)/?$ in.php?a = $ 1&amp; b = $ 2&amp; c = $ 3 #└└└└届─- - 流行 - - - −流园 - - - ──-─-─-─-─-─-─-─-─-─- - - 流行 - ─-─-─-─-─- - ─-─-┘
如果您最多需要五个路径段,则将此方案复制为五个规则。您当然可以使用更具体的
[^/]+
占位符。
在这里,订购并不重要,没有重叠。因此,首先拥有最常用的路径是可以的。另外,您可以通过
?p [] = $ 1&amp; p [] = $ 2&amp; p [] = 3
查询字符串 - 如果您的脚本仅优先 - 分裂。
(尽管只使用ALL规则并让脚本本身将段从请求_uri扩展出来。))
-
可选片段
prefix/opt?/opt?/opt?/code>
一个常见的变化是在规则中具有可选的前缀。如果您周围有静态字符串或更多受约束的占位符,这通常是有道理的:
重写 ^(\ w+)(?:/([ ^/]+))?/(\ w+)$?main = $ 1&amp; opt = $ 2&amp; suffix = $ 3
现在,更复杂的模式
(?:/([^/])+)?
只需包装 nontaps a nontaper(?:…)
组,使其可选)?
。包含
占位符([^/]+)
将是替代模式$ 2
,但是如果没有中间/…/
路径,请空置。 -
捕获其余的
/prefix/prefix/123-capture/…/*/…whythy…
如前所述,您通常不希望过于通用的重写模式。但是,将静态和特定比较与
。
rewriterule ^(特定)/prefix/(\ d+)(/.*)?$ speci.php?id = $ 2&amp; eapherparams = $ 2
此可选化任何
/…/…/…
尾随路径段。当然,这需要处理脚本将它们拆分, variabl-ifie 提取的参数
这是 web-“ mvc” Frameworks。 -
尾声“扩展”
/old/path.html
URL实际上没有文件扩展名。这就是整个引用的内容(= url是虚拟定位器,不一定是直接文件系统图像)。
但是,如果您之前有1:1的文件映射,则您的可以更简单的规则:重写 ^样式/([\ w \。\ - ]+)\。css $ sass-cache.php?old_fn_base = $ 1 重写 ^images/([\ w \。\ - ]+)\。gif $ png-converter.php?load_from = $ 2
其他常见用途是重新启动
.html
途径到新的.php
处理程序,或者仅适用于个人(实际/真实)文件的目录名称。 -
ping-pong(重定向和重写一致)
/ugly.html
←→/pretty
kbd>因此,在某个时候,您正在重写HTML页面以仅带有漂亮的链接,如。
同时,您仍然会收到有关 Old 路径的请求,有时甚至是从书签中获得的。如 vormaround ,您可以平台浏览器以显示/建立
新的URL。这种常见的窍门涉及发送30倍/位置重定向每当传入的URL遵循过时的/丑陋的命名方案时。
然后,浏览器将 rerequest 新/漂亮的URL,然后将其重写(内部)为原始或新位置。#旧/丑陋传入路径的重定向浏览器 重写 ^旧 /团队\ .html $ /teams [r = 301,QSA,结束] #内部重新映射已经出现的请求 重写 ^teams $ teams.php [qsa,end]
请注意此示例如何仅使用
[end]
而不是[L]
安全地交替。对于较旧的Apache 2.2版本,您可以使用其他解决方法,此外还可以重新映射
查询字符串参数例如:
重定向丑陋,回到漂亮的路线,重新回到丑陋的路径,没有无限循环 -
空格 在模式中
不是在浏览器地址栏中漂亮,但是您可以在URL中使用空格。对于重写模式,使用Backslash-escaped
\␣
空格。
否则只是“
- 引用整个模式或替代:重写“^此[\ w]+/(。*)$“” index.php?id = $ 1” [l]
客户端将URL与
+
或%20
序列化。然而,在重写中,它们用所有相对路径段的字面字符进行解释。
。
- 具有所有 to-index-php-使用mod-useRite“>中央调度程序/front-controller脚本
rewriteCond%{request_uri}!-f 重新WritriteCond%{request_uri}!-d 重写 ^。*$ index.php [l]
通常由PHP Frameworks或WebCMS / Portal脚本使用。然后,使用
$ _ server [“ request_uri”]
在PHP中处理实际路径分配。因此,从概念上讲,这与URL处理“ Per Mod_rewrite”几乎相反。 (只需使用fallbackResource
相反。)
-
删除
www。
请注意,这不会复制查询字符串,等等。
##┌─I-€�I-─-─-─-─-─-┐ rewriteCond%{http_host} ^www \。(。+)$ [nc]│ 重写 ^(。*)$ http://%1/$ 1 [r = 301,l]│ #↓└└└└└└└┼邮等……─-─-─-─-─..- - ─┘ #└└前达克 - �—─-─达队 - ─..- - ─-─..-┘
另请参见:
· url在.htaccess中的不同协议中的不同协议
·
· .htaccess-如何强制“ www”。以通用的方式?请注意,重新写入/重写组合可能更复杂,匹配项(
%1
和$ 1
)甚至在两个方向上进行交互:apache Manual -mod_rewrite Manual -mod_rewrite Manual -mod_rewrite intro ,Al-2.0
-
重定向到
https://
rewriteCond%{server_port} 80 重写 ^(。*)$ https://example.com/qul 1 [r,l]
另请参阅: httpps://wiki.apache.org/httpdpdpdpdpd/rewritehtpd/rewritehttptptptptptptptpps
-
“删除” php扩展名
rewriteCond%{request_filename} .php -f 重写 ^(。+)$ 1.php [l]#或[end]
另请参阅:使用mod_rewrite < < < /p>
-
与.php脚本
的混音旧.html路径
请参阅: http://httpd.apache.org/ docs/2.4/reprite/remapping.html#向后兼容性
- 喜欢“/page”到诸如“/index.php/page”之类的脚本
-
重定向子域中H3>
参见 )?
普遍存在的 .htaccess
陷阱
现在用一粒盐将其带走。并非所有建议都可以推广到所有情况下。
这只是众所周知的简单摘要和一些毫无意义的绊脚石:
-
eNable
mod_rewrite
和.htaccess
实际使用重写曲线,在每个导向配置文件中必须:
-
检查您的服务器
allioverride all
启用。否则,您的每个指导.htaccess
指令将被忽略,并且重新写入将无法正常工作。 -
显然有
mod_rewrite 启用
在您的
httpd.conf
模块部分中。 仍然使用
上的rewriteEngine预先预留每个规则列表。虽然mod_rewrite在
&lt; virtualHost&gt;
and&lt; directory&gt;
e节中隐含地活动。
每个指导.htaccess
文件需要单独召唤它。
-
-
领先的斜杠
^/
无法匹配您不应使用
.htaccess
使用^/
正常地重写图案:重写 ^/actity/\ d+$… ↑
这在旧教程中经常看到。对于古代Apache 1.x版本,它曾经是正确的。如今,请求路径在
.htaccess
重新写入曲目中方便地完全完全目录相关 。只需将领先的/
离开即可。·这就是为什么您经常看到它的
^/?
用于规则奇偶校验的可选。
·或使用rewriteCond%{request_uri}
您仍然需要匹配领先的/
。
·另请参见 webmaster.se:se:什么时候在mod_rewrite模式中需要领先的斜杠(/)? -
wrappers begone!You've probably seen this in many examples:
改写… - It does make sense in
sections - if it was combined with another fallback option, such as ScriptAliasMatch. (But nobody ever does that). - And it's commonly distributed for default
.htaccess
rulesets with many open source projects. There it's just meant as fallback, and keeps "ugly" URLs work as default.
However you don't want that usually in your own
.htaccess
files.- Firstly, mod_rewrite does not randomly disengage. (If it did, you'd have bigger problems).
- Were it really be disabled, your RewriteRules still wouldn't work anyway.
- It's meant to prevent HTTP
500
errors. What it usually accomplishes is gracing your users with HTTP404
errors instead. (Not so much more user-friendly if you think about it.) - Practically it just suppresses the more useful log entries, or server notification mails. You'd be none the wiser as to why your RewriteRules never work.
What seems enticing as generalized safeguard, often turns out to be an obstacle in practice.
- It does make sense in
-
Don't use
RewriteBase
unless neededMany copy+paste examples contain a
RewriteBase /
directive. Which happens to be the implicit default anyway. So you don't actually need this. It's a workaround for fancy VirtualHost rewriting schemes, and misguessed DOCUMENT_ROOT paths for some shared hosters.It makes sense to use with individual web applications in deeper subdirectories. It can shorten RewriteRule patterns in such cases. Generally it's best to prefer relative path specifiers in per-directory rule sets.
-
Disable
MultiViews
when virtual paths overlapURL rewriting is primarily used for supporting virtual incoming paths. Commonly you just have one dispatcher script (
index.php
) or a few individual handlers (articles.php
,blog.php
,wiki.php
, …). The latter might clash with similar virtual RewriteRule paths.A request for
/article/123
for example could map toarticle.php
with a/123
PATH_INFO implicitly. You'd either have to guard your rules then with the commonplaceRewriteCond
!-f
+!-d
, and/or disable PATH_INFO support, or perhaps just disableOptions -MultiViews
.Which is not to say you always have to. Content-Negotiation is just an automatism to virtual resources.
-
Ordering is important
See Everything you ever wanted to know about mod_rewrite
if you haven't already. Combining multiple RewriteRules often leads to interaction. This isn't something to prevent habitually per[L]
flag, but a scheme you'll embrace once versed.
You can re-re-rewrite virtual paths from one rule to another, until it reaches an actual target handler.Still you'd often want to have the most specific rules (fixed string
/forum/…
patterns, or more restrictive placeholders[^/.]+
) in the early rules.
Generic slurp-all rules (.*
) are better left to the later ones. (An exception is aRewriteCond -f/-d
guard as primary block.) -
Stylesheets and images stop working
When you introduce virtual directory structures
/blog/article/123
this impacts relative resource references in HTML (such as
).
Which can be solved by:- Only using server-absolute references
href="/old.html"
orsrc="/logo.png"
- Often simply by adding
into your HTMLsection.
This implicitly rebinds relative references to what they were before.
You could alternatively craft further RewriteRules to rebind
.css
or.png
paths to their original locations.
But that's both unneeded, or incurs extra redirects and hampers caching. - Only using server-absolute references
-
RewriteConds just mask one RewriteRule
A common misinterpetation is that a RewriteCond blocks multiple RewriteRules (because they're visually arranged together):
RewriteCond %{SERVER_NAME} localhost RewriteRule ^secret admin/tools.php RewriteRule ^hidden sqladmin.cgi
Which it doesn't per default. You can chain them using the
[S=2]
flag. Else you'll have to repeat them. While sometimes you can craft an "inverted" primary rule to [END] the rewrite processing early. -
QUERY_STRING exempt from RewriteRules
You can't match
RewriteRule index.php\?x=y
, because mod_rewrite compares just against relative paths per default. You can match them separately however via:RewriteCond %{QUERY_STRING} \b(?:param)=([^&]+)(?:&|$) RewriteRule ^add/(.+)$ add/%1/$1 # ←──﹪₁──┘
See also How can I match query string variables with mod_rewrite?
-
.htaccess
vs.If you're using RewriteRules in a per-directory config file, then worrying about regex performance is pointless. Apache retains
compiled PCRE patterns longer than a PHP process with a common routing framework. For high-traffic sites you should however consider
moving rulesets into the vhost server configuration, once they've been battle-tested.In this case, prefer the optionalized
^/?
directory separator prefix. This allows to move RewriteRules freely between PerDir and server
config files. -
Whenever something doesn't work
Fret not.
-
Compare
access.log
anderror.log
Often you can figure out how a RewriteRule misbehaves just from looking at your
error.log
andaccess.log
.
Correlate access times to see which request path originally came in, and which path/file Apache couldn't resolve to (error 404/500).This doesn't tell you which RewriteRule is the culprit. But inaccessible final paths like
/docroot/21-.itle?index.php
may give away where to inspect further.
Otherwise disable rules until you get some predictable paths. -
Enable the RewriteLog
See Apache RewriteLog docs. For debugging you can enable it in the vhost sections:
# Apache 2.2 RewriteLogLevel 5 RewriteLog /tmp/rewrite.log # Apache 2.4 LogLevel alert rewrite:trace5 #ErrorLog /tmp/rewrite.log
That yields a detailed summary of how incoming request paths get modified by each rule:
[..] applying pattern '^test_.*
Which helps to narrow down overly generic rules and regex mishaps.
See also:
· .htaccess not working (mod_rewrite)
· Tips for debugging .htaccess rewrite rules -
Before asking your own question
As you might know, Stack Overflow is very suitable for asking questions on mod_rewrite. Make them on-topic
by including prior research and attempts (avoid redundant answers), demonstrate basic regex understanding, and:- Include full examples of input URLs, falsly rewritten target paths, your real directory structure.
- The complete RewriteRule set, but also single out the presumed defective one.
- Apache and PHP versions, OS type, filesystem, DOCUMENT_ROOT, and PHPs
$_SERVER
environment if it's about a parameter mismatch. - An excerpt from your
access.log
anderror.log
to verify what the existing rules resolved to. Better yet, arewrite.log
summary.
This nets quicker and more exact answers, and makes them more useful to others.
-
-
Comment your
.htaccess
If you copy examples from somewhere, take care to include a
# comment and origin link
. While it's merely bad manners to omit attribution,
it often really hurts maintenance later. Document any code or tutorial source. In particular while unversed you should be
all the more interested in not treating them like magic blackboxes. -
It's not "SEO"-URLs
Disclaimer: Just a pet peeve. You often hear pretty URL rewriting schemes referred to as "SEO" links or something. While this is useful for googling examples, it's a dated misnomer.
None of the modern search engines are really disturbed by
.html
and.php
in path segments, or?id=123
query strings for that matter. Search engines of old, such as AltaVista, did avoid crawling websites with potentially ambigious access paths. Modern crawlers are often even craving for deep web resources.What "pretty" URLs should conceptionally be used for is making websites user-friendly.
- Having readable and obvious resource schemes.
- Ensuring URLs are long-lived (AKA permalinks).
- Providing discoverability through
/common/tree/nesting
.
However don't sacrifice unique requirements for conformism.
Tools
There are various online tools to generate RewriteRules for most GET-parameterish URLs:
- http://www.generateit.net/mod-rewrite/index.php
- http://www.ipdistance.com/mod_rewrite.php
- http://webtools.live2support.com/misc_rewrite.php
Mostly just output [^/]+
generic placeholders, but likely suffices for trivial sites.
to uri 'index.php'
[..] strip per-dir prefix: /srv/www/vhosts/hc-profi/index.php -> index.php
[..] applying pattern '^index\.php
Which helps to narrow down overly generic rules and regex mishaps.
See also:
· .htaccess not working (mod_rewrite)
· Tips for debugging .htaccess rewrite rules
Before asking your own question
As you might know, Stack Overflow is very suitable for asking questions on mod_rewrite. Make them on-topic
by including prior research and attempts (avoid redundant answers), demonstrate basic regex understanding, and:
- Include full examples of input URLs, falsly rewritten target paths, your real directory structure.
- The complete RewriteRule set, but also single out the presumed defective one.
- Apache and PHP versions, OS type, filesystem, DOCUMENT_ROOT, and PHPs
$_SERVER
environment if it's about a parameter mismatch.
- An excerpt from your
access.log
and error.log
to verify what the existing rules resolved to. Better yet, a rewrite.log
summary.
This nets quicker and more exact answers, and makes them more useful to others.
Comment your .htaccess
If you copy examples from somewhere, take care to include a # comment and origin link
. While it's merely bad manners to omit attribution,
it often really hurts maintenance later. Document any code or tutorial source. In particular while unversed you should be
all the more interested in not treating them like magic blackboxes.
It's not "SEO"-URLs
Disclaimer: Just a pet peeve. You often hear pretty URL rewriting schemes referred to as "SEO" links or something. While this is useful for googling examples, it's a dated misnomer.
None of the modern search engines are really disturbed by .html
and .php
in path segments, or ?id=123
query strings for that matter. Search engines of old, such as AltaVista, did avoid crawling websites with potentially ambigious access paths. Modern crawlers are often even craving for deep web resources.
What "pretty" URLs should conceptionally be used for is making websites user-friendly.
- Having readable and obvious resource schemes.
- Ensuring URLs are long-lived (AKA permalinks).
- Providing discoverability through
/common/tree/nesting
.
However don't sacrifice unique requirements for conformism.
Tools
There are various online tools to generate RewriteRules for most GET-parameterish URLs:
- http://www.generateit.net/mod-rewrite/index.php
- http://www.ipdistance.com/mod_rewrite.php
- http://webtools.live2support.com/misc_rewrite.php
Mostly just output [^/]+
generic placeholders, but likely suffices for trivial sites.
to uri 'index.php'
Which helps to narrow down overly generic rules and regex mishaps.
See also:
· .htaccess not working (mod_rewrite)
· Tips for debugging .htaccess rewrite rules
Before asking your own question
As you might know, Stack Overflow is very suitable for asking questions on mod_rewrite. Make them on-topic
by including prior research and attempts (avoid redundant answers), demonstrate basic regex understanding, and:
- Include full examples of input URLs, falsly rewritten target paths, your real directory structure.
- The complete RewriteRule set, but also single out the presumed defective one.
- Apache and PHP versions, OS type, filesystem, DOCUMENT_ROOT, and PHPs
$_SERVER
environment if it's about a parameter mismatch. - An excerpt from your
access.log
anderror.log
to verify what the existing rules resolved to. Better yet, arewrite.log
summary.
This nets quicker and more exact answers, and makes them more useful to others.
Comment your .htaccess
If you copy examples from somewhere, take care to include a # comment and origin link
. While it's merely bad manners to omit attribution,
it often really hurts maintenance later. Document any code or tutorial source. In particular while unversed you should be
all the more interested in not treating them like magic blackboxes.
It's not "SEO"-URLs
Disclaimer: Just a pet peeve. You often hear pretty URL rewriting schemes referred to as "SEO" links or something. While this is useful for googling examples, it's a dated misnomer.
None of the modern search engines are really disturbed by .html
and .php
in path segments, or ?id=123
query strings for that matter. Search engines of old, such as AltaVista, did avoid crawling websites with potentially ambigious access paths. Modern crawlers are often even craving for deep web resources.
What "pretty" URLs should conceptionally be used for is making websites user-friendly.
- Having readable and obvious resource schemes.
- Ensuring URLs are long-lived (AKA permalinks).
- Providing discoverability through
/common/tree/nesting
.
However don't sacrifice unique requirements for conformism.
Tools
There are various online tools to generate RewriteRules for most GET-parameterish URLs:
- http://www.generateit.net/mod-rewrite/index.php
- http://www.ipdistance.com/mod_rewrite.php
- http://webtools.live2support.com/misc_rewrite.php
Mostly just output [^/]+
generic placeholders, but likely suffices for trivial sites.
截至目前,您的行变量是类型char。这意味着它具有一个字符。如果要存储一个字符串,则可以使用固定大小的字符数组(C风格的字符串)或字符串对象。在C ++字符串对象中,应优选,因为它们比C风格的字符串具有多种优势,包括更高的安全性和较高的使用易用性。
例如,如果要获取用户输入的字符串对象的长度,则可以写出这样的内容,
#include <iostream>
#include <string>
// if you don’t want to use std:: put using namespace std; after the includes
int main(){
std::string str;
int strLength
std::cout << “Enter a Single Word: “;
std::cin >> str;
strLength = str.lenght();
std::cout << “The length of the word is “ << strLength << std::endl;
return 0;
}
如果您想获得完整的文本行,
std::cout << “Enter a Single Word: “;
std::cin >> str;
替换
std::cout << “Enter a Line of text: “;
std::getline(cin, str);
则可以使用C-Style String和strlen ( )但是,安全执行此操作要困难得多,并且通过执行诸如编写字符串之类的事情比所使用的固定大小数组的大小更长,这将使引起问题更容易引起问题,这可能会引起问题,因为可以将额外的数据写入区域不应写入,因此,如果您只是启动,则可能应该使用字符串对象。
如果您想要有关STD :: String的更多信息,请转到
https://en.cppreference.com/w/cpp/cpp/string/basic_string/basic_string
关于strlen为什么要返回40。strlen()工作的方式是,它采用一个称为指针的变量,该变量指向一系列字符的开始,并从指针开始浏览一系列字符,并寻找一个特殊的字符称为null字符'\ 0',并在此空字符之前返回数组中的字符数。如果C风格的字符串不以空字符结束,这可能会导致问题。
在您提供的代码的情况下,String2包含“”末尾的“”和null字符的所有40个字符,因此,当使用String2调用strlen()时,它会在NULL字符之前计数40个字符。
在String1的情况下,创建它时,它的大小与非初始化变量线中包含的值相等,在这种情况下似乎是0。这会导致String1用大小为0(根据对于语言标准来说,这是不确定的行为,但在某些情况下可能仍然“工作”)。因为String2后来在存储器中的字符串1之后直接在位置中创建,所以当String1 1时创建的字符串1启动的指针将其传递到Strlen指向string2的启动中,从而导致strlen在String1上调用时有效地测量String2的长度。
最后,作为小费。尽量避免将变量放置在全局范围(功能之外或其他封装实体之外)。这些全局变量有可能因可能导致代码中问题的方式而无意中改变的风险。通常,最好将这些变量放在主中,然后将它们传递到要使用它们的功能。如果要具有函数影响这些变量,则可以将它们作为引用传递到函数中。为此,您将放置AN&amp;在函数的参数类型的背后,将变量将传递给AS。
void function(std::string &str);
//… some other code
//… somewhere in main or another function
function(alteredString);
// some other code …
没有可移植的方法可以从Java控制台中读取原始字符。
上面已经介绍了一些依赖平台的解决方法。但是要真正便携,您必须放弃控制台模式并使用窗口模式,例如AWT或摇摆。
在快速视图中,您将数据定义为包含包含三个元素的元组的元组。
作为解决方案的第一步,应该使用列表,而不是元组元组:
data = [1, "john", 1/5/2022]
您可以尝试一下,让我知道它是否解决了还是需要更多帮助。
表示“感谢”是值得赞赏的,但没有回答这个问题。相反,投票最有助于您的答案!如果这些答案对您有帮助,请考虑以更具建设性的方式表示感谢 - 通过对同龄人在这里提出的问题做出自己的答案。
您可以使用
rollingfunctions
和映射
:You can do this with
RollingFunctions
andmapslices
:朱莉娅矩阵的列的平均值