我是使用C#的ASP .NET新手现在我需要一个问题的解决方案
在PHP中我可以像这样创建一个数组
$arr[] = array('product_id' => 12, 'process_id' => 23, 'note' => 'This is Note');
//Example
Array
(
[0] => Array
(
[product_id] => 12
[process_id] => 23
[note] => This is Note
)
[1] => Array
(
[product_id] => 5
[process_id] => 19
[note] => Hello
)
[2] => Array
(
[product_id] => 8
[process_id] => 17
[note] => How to Solve this Issue
)
)
Run Code Online (Sandbox Code Playgroud)
我想用ASP#在ASP .NET中创建相同的数组结构.
请帮我解决这个问题.提前致谢.
这是我的代码 http://my-localhost.com/iframe-test.html
<html>
<head><title>Welcome Iframe Test</title></head>
<body>
<iframe src="http://www.my-website.com/index.html" width="500" height="500"></iframe>
<script type="text/javascript">
function alertMyMessage(msg){
alert(msg);
}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是代码 http://www.my-website.com/index.html
<html>
<head></title>Welcome to my Server</title></head>
<body>
<h1>Welcome to My Server</ht>
<a href="javascript:void(0)" title="Click here" onClick="parent.alertMyMessage('Thanks for Helping me')">Click Here</a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
当我点击"点击这里"链接.我得到了以下错误.
未捕获的SecurityError:阻止具有原点" http://www.my-website.com "的框架访问具有原点" http://my-localhost.com " 的框架.协议,域和端口必须匹配.
请帮我修复此问题,或者为此提供一些其他解决方案.
我是laravel的新手,
我在我的控制器的__construct中有代码
if(Auth::check())
{
return View::make('view_page');
}
return Redirect::route('login')->withInput()->with('errmessage', 'Please Login to access restricted area.');
Run Code Online (Sandbox Code Playgroud)
它的工作正常,但我想要的是.将这些编码放在每个控制器中真的很烦人,所以我希望将这个验证Auth和重定向到一个地方的登录页面,可能在router.php
或filters.php
.
我已经阅读了论坛以及中的一些帖子stackoverflow
,并添加了filters.php
类似下面的代码,但这也无法正常工作.
Route::filter('auth', function() {
if (Auth::guest())
return Redirect::guest('login');
});
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题.
嗨,谢谢你...
我正在开发一个项目,我需要一些澄清,以高安全的方式在两个站点之间共享数据.目前我正在使用Form Post来共享数据.但我想是否有从site-2获取site-1会话数据的选项,因为我认为使用会话更安全.我不知道如何使用两个站点之间的会话,但我希望有人知道.
像这样:
站点1编码
$_SESSION['customer_id'] = 'XYZ';
$_SESSION['total_amount'] = '100';
<a href=https://site2.com/do.php?session_id=<?=$_SESSION['session_id']?>>Click Here</a>
Run Code Online (Sandbox Code Playgroud)
do.php中的站点2代码
$session_id = $_REQUEST['session_id'];
$shared_data = bla_bla_bla_function($session_id);
$customer_id = $shared_data['customer_id'];
$total_amount = $shared_data['total_amount'];
Run Code Online (Sandbox Code Playgroud)
或者有没有办法在表格帖子以外的两个网站之间进行安全的数据共享,请告诉我.
谢谢
你,
Kaartikeyan R.
找到解决方案
我已通过CURL将客户ID和金额发送到第二个网站,在此为表创建一个记录,并生成带有记录ID的加密ID,并返回加密的ID.
所以在First网站上我获得了加密ID,并在URL重定向到第二个网站时使用它.
在具有加密ID的第二个网站上,我获得了客户ID和金额.
在javascript我可以验证提交表格如下: -
<form action="" method="post" onsubmit="return validate(this)">
<input type="text" name="uName" id="uName" />
<input type="password" name="passKey" id="passKey" />
<input type="submit" name="loginBtn" value="login" />
</form>
<script type="text/javascript">
function validate(loginForm){
if(loginForm.uName.value == ''){
alert('Please Enter Username');
loginForm.uName.focus();
}else if(loginForm.passKey.value == ''){
alert('Please Enter Password');
loginForm.passKey.focus();
}else {
return true;
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
我试过下面的jQuery代码
<form action="" method="post">
<input type="text" name="uName" id="uName" />
<input type="password" name="passKey" id="passKey" />
<input type="submit" name="loginBtn" value="login" />
</form>
<script type="text/javascript">
$('form').submit(function(loginForm){
if(loginForm.uName.val() == ''){
alert('Please enter username');
loginForm.uName.focus();
}else …
Run Code Online (Sandbox Code Playgroud) 如何在Laravel Eloquent中执行以下查询?
SELECT catID, catName, imgPath FROM categories WHERE catType = "Root"
Run Code Online (Sandbox Code Playgroud)
我试过以下
CategoryModel::where('catType', '=', 'Root')
->lists('catName', 'catID', 'imgPath');
Run Code Online (Sandbox Code Playgroud)
但它只返回两个字段.
Array ( [7] => Category 1 )
Run Code Online (Sandbox Code Playgroud) 我正在开发Phonegap中的应用程序.我已经启用<preference name="webviewbounce" value="true" />
了我的config.xml
.
我android:theme="@android:style/Theme.Holo.Light.NoActionBar"
在Manifest.xml中使用.
问题是.我的index.html文件是红色背景.因此,当我在应用程序中向上滚动它在底部反弹,我看到白色背景:(.它真的很烦人,破坏了整个应用程序的外观.
所以现在我想将白色背景改成其他颜色.或者我想使用一些图像作为webview的背景.
我正在使用phonegap.2.7.0
请帮我解决这个问题.
嗨,我会解释我想要的......
我有一张像这样的记录表
...........................
country_name - 用户名
印度 - abc1
澳大利亚 - abc2
印度 - abc3
美国 - abc4
Australis - abc5
黎巴嫩 - abc6
...........................
从上面我需要获得国家名单而不重复,有没有机会得到这样的...
例行代码:
$sql = 'bla bla bla bla bla';
$res = mysql_query($sql);
while($row = mysql_fetch_array($res)){
echo $row['country_name'].'<br /><br />';
}
Run Code Online (Sandbox Code Playgroud)
Ex输出(像这样):
印度
澳大利亚
美国
黎巴嫩
如果有任何改变可以解决我的问题,请告诉我并提前感谢!
我已经在我的域( )中安装了 WordPress 博客Ex: http://mywordpresswebsite.com
。现在我有一个serve.php
在根目录中调用的 php 文件,例如http://mywordpresswebsite.com/serve.php
.
现在,如果我在浏览器中打开网址,就会显示找不到页面。
然后我在 htaccess 代码中添加了 RewriteRule ^serve.php$ serve.php [L]
,仍然显示找不到页面。
请尽快给我一个解决方案,提前谢谢。
我有这样的字符串1-male,2-female
我想把它作为数组如下
array(
1 => male,
2 => female
);
Run Code Online (Sandbox Code Playgroud)
我可以使用foreach Ex来做到这一点:
$str1 = '1-male,2-female';
$outPutArr = array();
$arr1 = explode(',' $str1);
foreach($arr1 as $str2){
$arr2 = explode('-', $str2);
$outPutArr[$arr2[0]] = $arr2[1];
}
Run Code Online (Sandbox Code Playgroud)
有没有其他捷径可以做到这一点?