function test(){
alert(chrome.extension.inIncognitoContext);
if(chrome.extension.inIncognitoContext){
chrome.tabs.query({currentWindow: true, active: true},function(tabs){
alert(tabs[0].url);
});
}
}
document.addEventListener('DOMContentLoaded', function() {
var link = document.getElementById('link');
// onClick's logic below:
link.addEventListener('click', function() {
test();
});
});
Run Code Online (Sandbox Code Playgroud)
这是我用于 chrome 扩展应用程序的 .js 文件,我在其中单击扩展中的按钮调用 test() 函数(下面是扩展的 html 代码)。在隐身模式和默认 chrome 中,它都警告为 false。我在另一个参考文献中看到使用布尔变量 chrome.extension.inIncognitoContext 来检查这个。我错了吗,代码有问题吗
<!doctype html>
<!--
This page is shown when the extension button is clicked, because the
"browser_action" field in manifest.json contains the "default_popup" key with
value "popup.html".
-->
<html>
<head>
<title>Getting Started Extension's Popup</title>
<style>
body …
Run Code Online (Sandbox Code Playgroud) 我正在创建 NSDictionary 并添加如下键值对
NSDictionary* dictionary = @{ @0: @"I am the value" };
Run Code Online (Sandbox Code Playgroud)
并检索如下值
NSString* value = [dictionary valueForKey:@0];
Run Code Online (Sandbox Code Playgroud)
应用程序因此而崩溃,我不明白原因,我提供了相同的数据类型和值。
@0 的数据类型是什么,我猜是 NSNumber,如果没有纠正我。
<?php
mysql_connect("mysql6.000webhost.com","a6124751_murali1","***");
$db= mysql_select_db("a6124751_signup");
$topic=$_GET["Topic"];
$question=$_GET["Question"];
$company =$_GET["Company"];
$query = "INSERT INTO questions (topic, question, company) VALUES ($topic, $question, $company)";
$sql1=mysql_query($query);
if (!$sql1) {
die('Invalid query: ' . mysql_error());
}
?>
Run Code Online (Sandbox Code Playgroud)
这是我在服务器中的php代码,其中有一个名为'questions'的表,我试图从前端使用表单从GET方法获得的输入中插入数据,我可以发现数据来自我使用echo检查的客户端.我收到错误了
您的SQL语法有错误; 检查与您的MySQL服务器版本对应的手册,以便在第1行使用"name,在此输入您的问题,公司"附近使用正确的语法
不知道查询中的错误是什么.任何人都尽快找到它.谢谢
class Myinteger(){
public:
Myinteger( int len ); // simple constructor
Myinteger( const Myinteger &obj); // copy constructor
~Myinteger(); // destructor
private:
int *ptr;
}
Myinteger::Myinteger(const Myinteger &obj) {
cout << "Copy constructor allocating ptr." << endl;
ptr = new int;
*ptr = *obj.ptr; // copy the value
}
int main(){
Myinteger obj1(10);
Myinteger obj2(20);
obj1=obj2;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
将obj2分配给obj1时不调用复制构造函数,我确认它是"复制构造函数分配ptr".没有打印到控制台,
因此,如果在将obj2分配给obj1时,如果没有调用复制构造函数在上述情况下调用哪个方法,那么也要告诉在哪些情况下调用类的复制构造函数.