编辑2
感谢大家的帮助!通过融合答案和其他一些论坛帖子我设法通过以下方式解决:
$string = strip_tags($oNode['div.item-prijs']);
$array = str_split($string,1);
$arraytotal = ( $array[0] . ',' . $array[1] . $array[2] );
echo $arraytotal;
Run Code Online (Sandbox Code Playgroud)
现在显示正确的价格."7,49"我自动转换为的PHP脚本.
对不起,我不能给更多的问题回答标记.案件结案.
拜托了伙计们
$price = strip_tags($oNode['div.item-prijs']);
$new_price = substr(chunk_split($price, 1, ','), 0, -1);
echo $new_price;
Run Code Online (Sandbox Code Playgroud)
这将回应7,4,9而不是7,49.但是这段代码是目前为止最好的代码.有人知道如何解决这个问题吗?
好吧,我现在已经坚持了一段时间..
我正在从网站解析数据,我想得到价格,但在网站上没有逗号或价格之间的点.所以它显示像499,4大于99.
当我做:
$price = $oNode['div.item-prijs'];
echo $price;
Run Code Online (Sandbox Code Playgroud)
它将回显499.我希望它添加逗号或4到99之间的点.
我试过了:
$price = $oNode['div.item-prijs'];
$new_price = substr(chunk_split($price, 1, ','), 0, -1);
echo $new_string;
Run Code Online (Sandbox Code Playgroud)
这将回应:
<,d,i,v, ,c,l,a,s,s,=,",i,t,e,m,-,p,r,i,j,s,",>,<,p,>,7,<,s,u,p,>,4,9,<,/,s,u,p,>,<,/,p,>,<,/,d,i,v,><,d,i,v, ,c,l,a,s,s,=,",i,t,e,m,-,p,r,i,j,s,",>,<,p,>,<,/,p,>,<,/,d,i,v,><,d,i,v, ,c,l,a,s,s,=,",i,t,e,m,-,p,r,i,j,s,",>,<,p,>,4,<,s,u,p,>,9,9,<,/,s,u,p,>,<,/,p,>,<,/,d,i,v,><,d,i,v, ,c,l,a,s,s,=,",i,t,e,m,-,p,r,i,j,s,",>,<,p,>,1,<,s,u,p,>,4,9,<,/,s,u,p,>,<,/,p,>,<,/,d,i,v,><,d,i,v, ,c,l,a,s,s,=,",i,t,e,m,-,p,r,i,j,s,",>,<,p,>,0,<,s,u,p,>,6,9,<,/,s,u,p,>,<,/,p,>,<,/,d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j,s,",>,<,p,>,1,<,s,u,p,>,4,9,<,/,s,u,p,>,<,/,p,>,<,/,d,i,v,><,d,i,v, ,c,l,a,s,s,=,",i,t,e,m,-,p,r,i,j,s,",>,<,p,>,2,<,s,u,p,>,9,9,<,/,s,u,p,>,<,/,p,>,<,/,d,i,v,><,d,i,v, ,c,l,a,s,s,=,",i,t,e,m,-,p,r,i,j,s,",>,<,p,>,1,<,s,u,p,>,9,9,<,/,s,u,p,>,<,/,p,>,<,/,d,i,v,><,d,i,v, ,c,l,a,s,s,=,",i,t,e,m,-,p,r,i,j,s,",>,<,p,>,1,<,s,u,p,>,0,9,<,/,s,u,p,>,<,/,p,>,<,/,d,i,v,><,d,i,v, …Run Code Online (Sandbox Code Playgroud) 与Java和MySQL相关:按下按钮并检查我的数据库后,ID为25的行仍然存在.为什么?
在QueryManager.java中,一切都已设置并使用数据库.这是在QueryManager.java中:
public void removeGebruiker() {
String query;
query = "delete from gebruiker where gebruiker_ID = 25";
}
Run Code Online (Sandbox Code Playgroud)
在userPanel.java中,我已经可以将用户添加到数据库,但删除不起作用.这是在userPanel.java中:
private void removeUserActionPerformed(java.awt.event.ActionEvent evt) {
WinkelApplication.getInstance().getQueryManager().removeGebruiker();
JOptionPane.showMessageDialog(null, "Gebruiker is verwijderd", "Gebruiker", JOptionPane.INFORMATION_MESSAGE);
}
Run Code Online (Sandbox Code Playgroud) 我想用PHP添加300个空格到文本文件.我不能 像你已经知道的那样使用(.txt格式,而不是HTML),那么怎么做呢?
因此,您可以看到此代码计算数字,我需要300个空格.
$spaces = 0; // will become 300 spaces
while ($spaces < 300)
{
$spaces++;
}
Run Code Online (Sandbox Code Playgroud)
并测试我将使用多少个空格
substr_count($spaces, ' ');
Run Code Online (Sandbox Code Playgroud)
谢谢
增加信息:
芯片不支持乘法,只有加法.我应该通过创建一个递归方法mult()来解决这个问题,该方法通过向自身添加x次来执行x和y的乘法运算.它的参数是x和y,它的返回值是x和y的乘积.然后我应该编写方法和main()来调用它.
这是纯粹的逻辑思维,但每当我试着想要做什么时,我都会迷失方向.
我被困在数学部分..我有什么,这不起作用,我知道数学是错的,但我不擅长这个:
public static void mult(int x, int y) {
x = 0;
y = 0;
if (y > 0) {
for (int i = 0; i < y; i++) {
x = x * (x * y);
return mult(x, y);
}
}
}
Run Code Online (Sandbox Code Playgroud) 每当我单击导航栏上的文本时,它都可以正常工作,但是在文本周围的彩色框上,它不起作用.如何解决这个问题?
谢谢
// navigation
ul
{
text-align: left;
display: inline;
padding: 15px 4px 17px 0;
list-style: none;
}
ul li
{
font-family: 'century gothic', arial, sans-serif;
color: #fff;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #4479BA;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
border: solid 1px #20538D;
z-index: 10;
}
ul li:hover
{
background: #3E6FAB;
color: #fff;
}
ul li …Run Code Online (Sandbox Code Playgroud) 这对我来说有点混乱,但我必须看看我在x中出现了多少次.因此,如果有人为i输入3而x为4294967295,则应该说0次,但如果有人输入9表示i和4294967295表示x,则应该说3次.
这就是我所拥有的,但输出0表示为0,所以它不起作用..
int main(int argc, char** argv) {
unsigned int i;
scanf("%u", &i);
unsigned int x;
scanf("%u", &x);
int output = 0;
int t = 0;
while (t < 10) {
x /= 10;
if (i == x) {
output++;
}
t++;
}
printf("%d", output);
}
Run Code Online (Sandbox Code Playgroud)