我不知道我的 PHP 发生了什么。我正在使用我自己开发的一堆类和一个半 MVC 框架(作为实验)。所以 PHP 文件包含了很多类文件。
我的错误消息的 PHP 行号完全关闭,因此无用,使我无法调试。例如,现在我收到一条错误消息,内容为:
`Parse error: syntax error, unexpected ')' in /view.php on line 209
Run Code Online (Sandbox Code Playgroud)
唯一的问题是:在第 209 行附近没有“)”。更糟糕的是,如果我die()在第 200 行左右,它仍然给我一条错误消息,现在被推到第 210 行。很明显,代码行是被考虑在内,但由于某种原因它并没有消亡。
另一件事是,它在此行之前包含一个 header.php 文件。头文件基本上只是输出一些 HTML,在其他页面上工作正常。然而在这个页面上,它甚至不输出标题;它只是死在一个空白页和那个错误信息上。
我能做些什么来使用更可靠的调试吗?如果我能有一个准确的行号,我相信我会很容易找到这个错误。
编辑:我发现了错误。这个问题的重点不是解决意外的 ')' 错误。关键是:为什么行号不准确?实际的错误消息在第 218 行,而不是 209 或 210。
我有一个简单的ajax调用:
function message(){
$.ajax({
type: "GET",
url: "/file/timestamp="+ timestamp,
async: true,
cache: false,
success: function(data){
var json = eval('('+data+')');
console.log(json);
}
});
}
Run Code Online (Sandbox Code Playgroud)
我Uncaught SyntaxError: Unexpected token <在这一行收到一个错误:var json = eval('('+data+')');
有任何想法吗?
谢谢。
编辑:错误中的更多详细信息:
$.ajax.successajax.js:9
f.Callbacks.njquery.js:2
f.Callbacks.o.fireWithjquery.js:2
wjquery.js:4
f.support.ajax.f.ajaxTransport.send.d
Run Code Online (Sandbox Code Playgroud)
如果有帮助,这里有一些 php
public function fileAction()
{
$this->getHelper('viewRenderer')->setNoRender();
$filename = '/test/text.txt';
$front = Zend_Controller_Front::getInstance();
$data = $front->getRequest()->getParams();
$lastModif = !empty($data['timestamp']) ? $data['timestamp'] : 0;
$currentModif = filemtime($filename);
while($currentModif <= $lastModif){
usleep(10000);
clearstatcache();
$currentModif = filemtime($filename);
}
$response = array(); …Run Code Online (Sandbox Code Playgroud) 我在 MVC 3 中有一个项目。它运行良好,每次我构建它时,它都会成功。但是,Visual Studio 坚持在每个 razor 语法的视图中显示编译错误。例如:
当前上下文中不存在名称“模型” D:\ ... Detail.cshtml
那行很简单:
@model Namespace.DetailViewModel
Run Code Online (Sandbox Code Playgroud)
我已经试过了:
bin和obj文件夹。注意:我使用的是 Visual Studio 2012。
asp.net-mvc syntax-error razor asp.net-mvc-3 visual-studio-2012
所以我正在编写(或至少尝试编写)一个程序来比较在 python 中运行的两个 gdb 的输出。这是我到目前为止:
from subprocess import *
import subprocess
file = raw_input('enter program name (with a ./ if in local directory): ')
p1 = Popen(['gdb', file], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p2 = Popen(['gdb', file], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p1.communicate(input='break main')
p2.communicate(input='break main')
args1 = raw_input('args for running program (from file) (ie r < input.txt): ')
args2 = raw_input('args for running program (from file) (for program 2...): ')
p1.communicate(input=args1)
p2.communicate(input=args2)
while True:
p1out = p1.communicate(input='continue')[0]
p2out = p2.communicate(input='continue')[0]
if p1out != …Run Code Online (Sandbox Code Playgroud) Moved the site to another server. Add file statistic.php to the ?ron to perform. Only this Cron that does not like something. Write errors:
/home/site/www/statistic.php: line 1: ?php: No such file or directory
/home/site/www/statistic.php: line 2: syntax error near unexpected token `"bd.php"'
/home/site/www/statistic.php: line 2: `include ("bd.php");
Run Code Online (Sandbox Code Playgroud)
There is my code
<?php
include ("bd.php");
$result = mysql_query("SELECT MAX(id) FROM statistic_dep",$db);
$myrow1 = mysql_fetch_array($result);
$last_id=$myrow1[0];
...
Run Code Online (Sandbox Code Playgroud) 我收到了这个WSDL,我遇到了XSD的问题.
我似乎无法在我的XSD文件中找到问题.
什么没约束?我怎么解决这个问题?
error: The prefix "xsd" for element "xsd:schema" is not bound.
Run Code Online (Sandbox Code Playgroud)
这是XSD文件的一部分:
<xsd:schema targetNamespace="http://www.informatica.com/wsdl/"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://www.informatica.com/wsdl/"
xmlns:infatype="http://www.informatica.com/types/">
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/http/"/>
<xsd:element name="SHA003Bis_GetArticleDataResponse"
type="SHA003Bis_GetArticleDataResponseType"/>
<xsd:element name="SHA003Bis_GetArticleDataRequest"
type="SHA003Bis_GetArticleDataRequestType"/>
<xsd:complexType name="SHA003Bis_GetArticleDataRequestType">
<xsd:sequence>
<xsd:element name="SHA003Bis_GetArticleDataRequestElement">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Company" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:integer"/>
</xsd:simpleType>
</xsd:element>
Run Code Online (Sandbox Code Playgroud)
这是WSDL的一部分:
<wsdl:definitions targetNamespace="http://www.informatica.com/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:n="http://www.informatica.com/wsdl/"
xmlns:infa="http://www.informatica.com/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema targetNamespace="http://www.informatica.com/wsdl/"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://www.informatica.com/wsdl/"
xmlns:infatype="http://www.informatica.com/types/">
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/http/"/>
<xsd:element name="SHA003Bis_GetArticleDataResponse"
type="SHA003Bis_GetArticleDataResponseType"/>
<xsd:element name="SHA003Bis_GetArticleDataRequest"
type="SHA003Bis_GetArticleDataRequestType"/>
<xsd:complexType name="SHA003Bis_GetArticleDataRequestType">
<xsd:sequence>
<xsd:element name="SHA003Bis_GetArticleDataRequestElement">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Company" …Run Code Online (Sandbox Code Playgroud) 以下代码的语法无效:
# bad_code.rb
def foo
next
end
$ ruby bad_code.rb
bad_code.rb:2: Invalid next
bad_code.rb: compile error (SyntaxError)
Run Code Online (Sandbox Code Playgroud)
但是,运行时ruby -c bad_code.rb没有检测到任何问题:
$ ruby -c bad_code.rb
Syntax OK
Run Code Online (Sandbox Code Playgroud)
但是ruby -c应该用于检查语法:
-c仅检查语法
为什么不检测到这个错误?
rubocop bad_code.rb 也没有发现这个:
$ rubocop bad_code.rb
Inspecting 1 file
.
1 file inspected, no offenses detected
Run Code Online (Sandbox Code Playgroud)
我在Ruby 2.1.10上运行了这个.
cat test.json | jq 'map(if ParameterKey == "Project" then . + {"ParameterValue" = "jess-project"} else . end )'
jq: error: syntax error, unexpected '=', expecting '}' (Unix shell quoting issues?) at <top-level>, line 1:
map(if ParameterKey == "Project" then . + {"ParameterValue" = "jess-project"} else . end )
jq: 1 compile error
Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的反应应用程序中使用 redux-saga,但我仍然有这个错误:
动作必须是普通对象。使用自定义中间件进行异步操作。
错误是:
15 | changeText = event => {
> 16 | this.props.changeText(event.target.value);
17 | };
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
App.js
import React, { Component } from "react";
import logo from "./logo.svg";
import "./App.css";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import * as actions from "./redux/actions";
import { initStore } from "./redux/store";
class App extends Component {
changeText = event => {
this.props.changeText(event.target.value);
};
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" …Run Code Online (Sandbox Code Playgroud) 我在编译 ejs 时在参数列表之后收到错误:缺少 )。我尝试了很多次,但我找不到问题所在。
这是导致错误的 ejs。这段代码有什么问题?
<%- include('../_layouts/adminheader') %>
<h2 class='page-title'>Products</h2>
<br>
<a href="/admin/products/add-product" class="btn btn-primary">Add a new product</a>
<br><br>
<% if (count > 0) { %>
<table class="table table-striped">
<thead>
<tr class="home">
<th>Product</th>
<th>Price</th>
<th>Category</th>
<th>Product Image</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<% products.forEach(function(product) { %>
<tr>
<td><%= product.title %></td>
<td>$<%= parseFloat(product.price).toFixed(2) %></td>
<td><%= product.category %></td>
<td>
<% if (product.image == "") { %>
<img src="/images/noimage.png">
<% } else { %>
<img src="product_images/<%= product._id %>/<%= product.image %>">
<% }%> …Run Code Online (Sandbox Code Playgroud)