Titanium:如何在加载WebView时设置referer(Titanium: How to set referer when loading WebView)
我目前正在使用它
mywebview.setUrl(the_url);
加载URL。
相反,我可以加载它,以便在http标头中包含一个引用程序吗?
编辑:原因是链接到的网站应该能够看到流量来自哪里,即使URL被加载到与包含链接的网页不同的网页视图中。 (我使用多个WebView来创建选项卡UI。)
编辑:xcode等价似乎是这样,虽然我不确定这是否也将它加载到新的webview中: 在嵌入式UIWebView中指定HTTP referer
I currently use this
mywebview.setUrl(the_url);
to load a URL.
Can I, instead, load it in such as way as to include a referer in the http header?
EDIT: The reason for this is that the linked-to website should be able to see where the traffic is coming from even if the URL is loaded into a different webview than the one that contained the link. (I use multiple WebViews to create a tab UI.)
Edit: The xcode equivalent seems to be this, although I'm not sure if this is also loading it into a new webview: Specifying HTTP referer in embedded UIWebView
原文:https://stackoverflow.com/questions/34949926
最满意答案
所有答案解释为什么你得到2而不是1实际上是错误的。 根据PHP文档,以这种方式混合
+
和++
是未定义的行为,所以你可以获得1或2.切换到不同版本的PHP可能会改变你得到的结果,它将是一样有效。见示例1 ,其中说:
// mixing ++ and + produces undefined behavior $a = 1; echo ++$a + $a++; // may print 4 or 5
笔记:
运算符优先级不能确定评估的顺序。 运算符优先级仅确定表达式
$l + ++$l
被解析为$l + (++$l)
,但不能确定是否首先计算+
运算符的左或右操作数。 如果首先评估左操作数,结果将为0 + 1,如果首先评估右操作数,结果将为1 + 1。操作员关联性也不影响评估顺序。
+
运算符离开关联性仅确定$a+$b+$c
被评估为($a+$b)+$c
。 它不会以什么顺序确定单个操作符的操作数被评估。另外相关:在关于另一个表达式的错误报告中 ,一个PHP开发人员说:“我们不保证评估顺序[...],就像C不一样,你可以指向在哪里说明首先对第一个操作数进行评估?
All the answers explaining why you get 2 and not 1 are actually wrong. According to the PHP documentation, mixing
+
and++
in this manner is undefined behavior, so you could get either 1 or 2. Switching to a different version of PHP may change the result you get, and it would be just as valid.See example 1, which says:
// mixing ++ and + produces undefined behavior $a = 1; echo ++$a + $a++; // may print 4 or 5
Notes:
Operator precedence does not determine the order of evaluation. Operator precedence only determines that the expression
$l + ++$l
is parsed as$l + (++$l)
, but doesn't determine if the left or right operand of the+
operator is evaluated first. If the left operand is evaluated first, the result would be 0+1, and if the right operand is evaluated first, the result would be 1+1.Operator associativity also does not determine order of evaluation. That the
+
operator has left associativity only determines that$a+$b+$c
is evaluated as($a+$b)+$c
. It does not determine in what order a single operator's operands are evaluated.Also relevant: On this bug report regarding another expression with undefined results, a PHP developer says: "We make no guarantee about the order of evaluation [...], just as C doesn't. Can you point to any place on the documentation where it's stated that the first operand is evaluated first?"
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
对于内置类型,您将是正确的:内置的分配运算符需要左侧的可修改的左值 。 但是,这不是使用内置的操作符,而是由类隐式声明的重载。 这是一个成员函数,相当于 A().operator=(A()); 并且可以在rvalue上调用成员函数。 For built-in types, you'd be correct: the built-in assignment operator requires a modifiable lvalue on the left hand side. However, this i ...
-
为什么是$ a + ++ $ a == 2?(Why is $a + ++$a == 2?)[2023-08-28]
所有答案解释为什么你得到2而不是1实际上是错误的。 根据PHP文档,以这种方式混合+和++是未定义的行为,所以你可以获得1或2.切换到不同版本的PHP可能会改变你得到的结果,它将是一样有效。 见示例1 ,其中说: // mixing ++ and + produces undefined behavior $a = 1; echo ++$a + $a++; // may print 4 or 5 笔记: 运算符优先级不能确定评估的顺序。 运算符优先级仅确定表达式$l + ++$l被解析为$l + (++$ ... -
如果A vs如果A不是None:(if A vs if A is not None:)[2021-06-26]
该声明 if A: 将调用A.__nonzero__() (请参阅特殊方法名称文档),并使用该函数的返回值。 总结如下: object.__nonzero__(self) 被称为实现真值测试和内置操作bool() ; 应返回False或True ,或其整数等于0或1 。 当没有定义此方法时, __len__() ,如果它被定义,并且如果该对象的结果为非零,该对象将被视为true。 如果一个类不定义__len__()和__nonzero__() ,它的所有实例都被认为是真的。 另一方面, if A is n ... -
因为浮点数学不是关联的 。 在浮点乘法中分组操作数的方式对答案的数值精度有影响。 因此,大多数编译器对于重新排序浮点计算非常保守,除非他们可以确定答案将保持不变,否则除非您告诉他们您不在乎数字精度。 例如:gcc 的-fassociative-math选项 ,它允许gcc重新关联浮点运算,甚至可以使用-ffast-math选项,这样可以更准确地反对速度。 Because Floating Point Math is not Associative. The way you group the operand ...
-
与(a *)*相同*(is a* the same as (a*)*?)[2023-08-10]
是的 , a*=(a*)*是相同的。 两者都会生成相同的语言,即包含null任何数字a。 L(a*) = {^, a, aa, aa...... } = L ((a*)*) (a*)*是一个有效的表达式吗? 是的,这个表达式叫做REGULAR-EXPRESSION (我看到你错过了标签)。 任何正则语言(RL)都可以用正则表达式(RE)表示。 代表RL的字母表方式。 为什么它是一样的? *表示重复任意次数(包括0次)。 a*表示0 a,1a,2a或任意数量的a。 (a *)*表示任意数量的时间(包括0次)在 ... -
可以($ a == 1 && $ a == 2 && $ a == 3)评估为真吗?(Can ($a == 1 && $a == 2 && $a == 3) ever evaluate to true?)[2023-01-09]
我刚试过这个: $a = true; echo ($a == 1 && $a == 2 && $a == 3); 它回应了1 。 由于类型转换而不是类型检查,与布尔值相比,1,2,3将被视为true 。 回答编辑:不,不能做。 @FrankerZ评论的Hackish方法 : 零字节字符= 0xFEFF http://shapecatcher.com/unicode/info/65279 http://www.unicodemap.org/details/0xFEFF/index.html $var = ... -
GHC是否将a * a * a * a * a优化为(a * a * a)*(a * a * a)?(Will GHC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)?)[2023-10-08]
这不是严格和懒惰之间的区别,而是浮点数语义的产物。 Haskell's Double与C的double或Java或其他大多数语言的语义大致相同。 非常聪明和合格人们已经认识并决定用合适的方式来表示合理的十进制数是二进制的,我们或多或少地坚持它。 所以答案是否定的,因为四舍五入与评估顺序无关。 虽然在这里我们似乎正在讨论GHC用于添加浮点数的primop,但要记住+在Haskell中是可扩展的,只是一个正常的函数。 Num类的新实例没有义务提供关联操作。 作为一个简单的例子,我有一个库让用户在Haskell ... -
&a是int (*)[2] 。 即指向数组的指针。 但是int *b=&a; 分配给整数指针。 虽然它指向正确的地址,但您需要进行类型转换以删除警告消息。 添加(int*)类的。 int *b=(int*)&a; #include
int main() { int a[2] = {10,20}; int *b=(int*)&a; printf("\n :%d %d\n", b[0], b[1]); #if 0 printf("%p\n",a); ...