我用"urlencoded"字符串"%2B"替换"+"符号时遇到了一些麻烦.我怎样才能做到这一点?
这就是我尝试过的:
文本输入文本框:
plus(+)
Run Code Online (Sandbox Code Playgroud)
然后我urlencode字符串:
$string = urlencode($string);
Run Code Online (Sandbox Code Playgroud)
字符串现在看起来像:
plus%28+%29
Run Code Online (Sandbox Code Playgroud)
我想要"+"urlencoded,否则当我在urldecode()中显示要在浏览器中显示的数据时,我最终得到:
plus( )
Run Code Online (Sandbox Code Playgroud)
因为urldecode()将"+"解释为空格.
我尝试使用php的str_replace(),但我一直得到一个"NULL"作为"$ new_string"的值返回:
$new_string = str_replace('+', '%2B', $string);
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
提前致谢!
我有一个jquery ui对话框我想用来提示用户确认删除.当用户按下"是"或"否"时,我需要返回"True"或"False"以继续执行一些javascript.下面的代码的问题是当对话框显示它立即执行"return true"时 但用户还没按下"是"按钮呢?
我究竟做错了什么?
HTML:
<div id="modal_confirm_yes_no" title="Confirm"></div>
Run Code Online (Sandbox Code Playgroud)
Javascript电话:
$("#modal_confirm_yes_no").html("Are you sure you want to delete this?");
var answer = $("#modal_confirm_yes_no").dialog("open");
if (answer)
{
//delete
}
else
{
//don't delete
}
Run Code Online (Sandbox Code Playgroud)
Jquery对话框:
$("#modal_confirm_yes_no").dialog({
bgiframe: true,
autoOpen: false,
minHeight: 200,
width: 350,
modal: true,
closeOnEscape: false,
draggable: false,
resizable: false,
buttons: {
'Yes': function(){
$(this).dialog('close');
return true;
},
'No': function(){
$(this).dialog('close');
return false;
}
}
});
Run Code Online (Sandbox Code Playgroud) 我最近改变了一些我的页面通过ajax显示,我对于为什么utf8编码现在在一个盒子里面显示一个问号,而在它没有之前有一些混乱.
例如.oringal页面是index.php.charset明确地设置为utf8并且在<head>.然后我用php来查询数据库
Heres是原始的index.php页面:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Title here</title>
</head>
<body class='body_bgcolor' >
<div id="main_container">
<?php
Data displayed via php was simply a select statement that output the HTML.
?>
</div>
Run Code Online (Sandbox Code Playgroud)
但是,当我进行更改以添加通过ajax填充"main_container"的菜单时,所有utf8编码都停止工作.这是新代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Title here</title>
</head>
<body class='body_bgcolor' >
<a href="#" onclick="display_html('about_us');"> About Us </a>
<div id="main_container"></div>
Run Code Online (Sandbox Code Playgroud)
"display_html()"函数调用javascript页面,该页面使用jquery ajax调用来检索存储在php页面中的html,然后将html放在div中,其id为"main_container".我将jquery中的charset设置为utf8,如:
$.ajax({
async: false,
type: "GET",
url: …Run Code Online (Sandbox Code Playgroud) 尝试从存储过程中调用存储的函数时,我收到1064错误.它只发生在我尝试这样做的行上:SET account_id = get_account_id(user);.有什么问题,我该如何解决?
帐户ID存储功能:
CREATE DEFINER=`aaron`@`%` FUNCTION `get_account_id`(user VARCHAR(255)) RETURNS int(11)
BEGIN
DECLARE xaccount_id INT DEFAULT 0;
#Get Account ID and place into variable used when calling stored procedure that builds the tree structure for the leaf node portfolio id
SELECT account_id
FROM rst_sessions.session_data
WHERE username = user
ORDER BY update_date DESC LIMIT 1
INTO xaccount_id;
RETURN xaccount_id;
END
Run Code Online (Sandbox Code Playgroud)
尝试调用存储函数的存储过程:
CREATE DEFINER=`aaron`@`%` PROCEDURE `build_report_portfolio_list`(user VARCHAR(255))
READS SQL DATA
BEGIN
DECLARE portf_id INT;
DECLARE portf_name VARCHAR(255);
DECLARE str_portf_parent_list …Run Code Online (Sandbox Code Playgroud) mysql sql stored-procedures stored-functions mysql-error-1064
我想阻止直接url访问某些选定的目录.但是,可以在所选目录中创建一些文件,以便直接访问url.我在编写<filesmatch>部分时遇到了一些麻烦,无法访问"xml /"目录中的.php文件.我想在filesmatch指令中包含"path"的一部分,而不是为每个目录创建单独的<directorymatch>指令,我希望某些文件可用,但它不起作用......如果我删除"/xml /"并放<FilesMatch "\.(php)$">
在我的httpd.conf中,我设置了一个虚拟目录.在虚拟目录中,我添加了以下内容:
<DirectoryMatch "^/data/servers/dev.site.com/web/administrator/(includes|xml|css|javascript|stylesheet|cache|classes|acco
unt_files)">
AddType application/x-httpd-php .php .html .htm
Options none
AllowOverride All
Order Deny,Allow
Deny from all
#Target all files in "xml/" directory that end in ".php"
<FilesMatch "/xml/\.(php)">
AddType application/x-httpd-php .php
Order Allow,Deny
Allow from all
</FilesMatch>
</DirectoryMatch>
Run Code Online (Sandbox Code Playgroud)
有谁知道我该怎么写这个?
谢谢您的帮助.
我想要使用其他css类的属性而不必重写代码......我对css不太精明所以请原谅我这个简单的问题.
是否可以在css中执行此类或类似的操作?
.class_a {
background:red;
}
.class_b{
.class_a;
}
Run Code Online (Sandbox Code Playgroud) 我有一个无序列表,当试图将它放在文本旁边时,背景图像被切断了.
我正在使用jquery将类添加到锚标签以显示图像,并且其工作正常,唯一的问题是图像被切断.我一直在玩css,但似乎无法弄清楚如何正确显示图像...似乎<li>隐藏在它后面的图像...我可以放置图像在<li>前面让它显示......还是我错过了别的东西?
有人能帮我吗?谢谢.
这是HTML:
<ul id="nav>
<li>
<a class="folder_closed">Item 1</a>
<div style="display:none">Content for item 1</div>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
这是CSS:
ul#nav{
margin-left:0;
margin-right:0;
padding-left:0px;
text-indent:15px;
}
#nav > li{
vertical-align: top;
text-align:left;
clear: both;
margin-left:0px;
margin-right:0px;
padding-right:0px;
padding-left:15px;
}
.folder_open{
position:relative;
background-image: url(../images/maximize.png);
background-repeat: no-repeat;
background-position: -5px 1px;
}
.folder_closed{
position:relative;
background-image: url(../images/minimize.png);
background-repeat: no-repeat;
background-position: -5px 1px;
}
Run Code Online (Sandbox Code Playgroud) 我很困惑这里发生了什么......它应该是基本的,但我无法弄明白.
我正在预编写一个表单,其中包含一些需要根据数据库进行检查的信息.当表单加载时,我希望javascript运行我需要验证的两个输入框的"模糊"事件.
这是最新发生的事情.当表单正确加载所有数据时,"用户名"和"电子邮件"输入的触发器("模糊")事件不会被触发.但是,如果我手动将光标放入每个输入中,然后按Tab键,或在框外单击,则会触发"模糊"事件.
我需要它也会在页面加载时触发,以警告用户预先填充的数据是否与现有数据冲突...任何想法我做错了什么或如何使其工作?
提前致谢.
<script type="text/javascript">
$(document).ready(function(){
//Username
$("#username").blur(function(){
$("#usr_available_msg").html("Checking").addClass("error_msg ui-state-error");
});
//email
$("#email").blur(function(){
$("#email_available_msg").html("Checking").addClass("error_msg");
});
//Run validation check on page load
$("#username").trigger("blur");
$("#email").trigger("blur");
});
</script>
Run Code Online (Sandbox Code Playgroud) 使用bash,我正在尝试为日期插入变量并在日志文件中搜索该日期,然后将输出发送到文件.如果我像这样对日期进行硬编码它会起作用:
sed -n '/Nov 22, 2010/,$p' $file >$log_file
Run Code Online (Sandbox Code Playgroud)
但如果我这样做就失败了:
date="Nov 22, 2010"
sed -n '/$date/,$p' $file >$log_file
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:sed: 1: "/Nov 22, 2010/,": expected context address
感谢您的帮助.
任何人都可以解释为什么Mysql给我错误1280("fk_chart_aid_aid'的错误索引")错误,当我尝试创建"帐户图表"表时.我在这里完全糊涂了.我该如何解决这个问题,以便创建表格?"ACCOUNT"表已存在于数据库中并且其中包含数据.
谢谢您的帮助.
MYSQL Server版本:5.1.54
账户表:
DROP TABLE IF EXISTS `rst`.`acctg_chart_of_accounts` ;
CREATE TABLE IF NOT EXISTS `rst`.`acctg_chart_of_accounts` (
`acctg_chart_of_accounts_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`account_id` INT UNSIGNED NOT NULL ,
`account_nbr` VARCHAR(45) NULL ,
`description` VARCHAR(45) NULL ,
`account_type` INT UNSIGNED NULL ,
`commissionable` TINYINT UNSIGNED NULL ,
`hidden` TINYINT UNSIGNED NULL ,
`deduct_balance_from_owner_check` TINYINT UNSIGNED NULL ,
PRIMARY KEY (`acctg_chart_of_accounts_id`) ,
CONSTRAINT `fk_chart_aid_aid`
FOREIGN KEY (`account_id` )
REFERENCES `rst`.`account` (`account_id` )
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE …Run Code Online (Sandbox Code Playgroud)