我正在管理一个由大约 100 个用户使用的系统。除了一个用户外,一切正常。当该用户登录时,源代码只会输出大约 70 行 og html,然后停止执行。PHP 没有显示任何错误,错误日志中也没有显示任何内容。在脚本中启用了错误。
如果我删除一些行,在 html 中,它将执行更多的 PHP,但仍然在源代码中的大约 70 行处停止。
正如我所说,这只会发生在一个用户身上。
有没有人知道这里可能出什么问题?
对于无法更改的Java服务器,我有以下代码片段:
....
while(true){
try {
System.out.println("Will listen . . .");
instruction = this.dis.readUTF(); // Socket's dataInputStream
System.out.println("Got instruction: " + instruction);
} catch (IOException ex) {
Logger.getLogger(ServerThread.class.getName()).log(Level.SEVERE, null, ex);
}
....
} // end while(true)
Run Code Online (Sandbox Code Playgroud)
我有以下python客户端代码:
....
self.socket.send(b"GET~CARD\n")
print self.socket.recv(1024)
....
Run Code Online (Sandbox Code Playgroud)
我面临的问题是,我可以让客户端向服务器发送信息,但服务器不会停止侦听,因此它停留在阻塞调用上this.dis.readUTF();。
如您所见,我尝试使用\n字符串末尾的字符,但它一直在监听。有谁知道如何使用从 python 客户端写入到 java 服务器readUTF()?
用例是调用(Google Drive)API 来获取数据。我了解执行请求的第一部分。但是为什么我们要传递 aresponse到函数中呢?如果有的话,我们不会得到回应吗?
是否有很好的资源来理解请求/响应以及服务器在概念上是如何工作的?或者有人可以发布一个类比吗?
如何取回响应的属性?
我有一个问题,我希望有人可以帮助我!
我有一个由 WordPress 提供支持的网站,里面有一些文章,我想建立一个网络,所以要进行多站点安装。我遵循了 WordPress Codex 上的步骤,首先在wp-config.php 中插入启用多站点的功能,然后我进入我的wp-admin并按照说明完成该过程。这是我在wp-config.php 中添加的代码:
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'website.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
Run Code Online (Sandbox Code Playgroud)
虽然这是我的 .htaccess 中的代码:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
Run Code Online (Sandbox Code Playgroud)
当我这样做时,我意识到即使在网络中创建一个新站点也无法加载:实际上,当我去站点 test.website.com 时,服务器没有响应,给了一个 Chrome现在我不记得的错误:这与 DNS 有关。所以我在网上搜索,我读到我需要创建一个通配符。根据我的理解,我需要创建一个A类型的新 …
我正在使用 socket.io,客户端看起来像这样。
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io();
socket.emit("sendData", "hello!");
</script>
Run Code Online (Sandbox Code Playgroud)
我想知道是什么阻止了一个随机用户,加入我的网站,查看代码,然后使用 chromes 代码查看应用程序或类似的东西添加以下几行:
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io();
for(i = 0; i < 50; i++) {
socket.emit("sendData", "hello!");
}
</script>
Run Code Online (Sandbox Code Playgroud) DateTime 类(以及 DatePeriod 和 DateInterval)似乎在我当前的服务器上不起作用。PHP 5.3.3 是根据 phpinfo 页面安装的,当我将 get_declared_classes() 函数作为数组运行以查看定义了哪些类时,这些类似乎确实存在:
数组([0] => stdClass [1] => Exception [2] => ErrorException [3] => Closure [4] => DateTime [5] => DateTimeZone [6] => DateInterval [7] => DatePeriod [8] => LibXMLError...
但是,即使我使用 DateTime 运行最简单的 PHP 代码,我也会收到 HTTP 500 错误:
$date = new DateTime('2000-01-01');
echo $date->format('Y-m-d H:i:s');
Run Code Online (Sandbox Code Playgroud)
这种较旧的符号确实可以正常工作,
$date = date_create('2000-01-01');
echo date_format($date, 'Y-m-d H:i:s');
Run Code Online (Sandbox Code Playgroud)
但出于某种原因,DateTime 无法正常工作。我在不同的服务器上使用这些 DateTime 对象编写了一些代码,并且运行良好。关于我可能有错误的想法?是否有我应该考虑的 php.ini 或其他设置?
-JF
如何将默认根目录更改为自定义
例如从xampp/htdocs文件夹到D:/Web 项目
我已经在这里尝试了所有提到的方法,并且在很多地方似乎都没有奏效。任何帮助,将不胜感激。
我想通过 Ruby 在我的 LAN 上生成(我不喜欢创建单词)本地服务器(如 localhost/8000),我研究了 ? 互联网,但我无法做到。我的目标是在本地服务器中显示 html 页面,使用 Ruby。我怎样才能做到?
require 'socket'
Run Code Online (Sandbox Code Playgroud)
我在标准库中使用套接字,但在刷新页面时出现错误。
require 'socket'
server = TCPServer.new('localhost', 2345)
loop do
socket = server.accept
request = socket.gets
STDERR.puts request
response = "Hello World!\n"
socket.print "HTTP/1.1 200 OK\r\n" +
"Content-Type: text/plain\r\n" +
"Content-Length: #{response.bytesize}\r\n" +
"Connection: close\r\n"
socket.print "\r\n"
socket.print response
socket.close
end
Run Code Online (Sandbox Code Playgroud) 我需要从我的服务器获取一些数据才能使我的应用程序正常工作。为了做到这一点,我将使用 POST。据我所知,我必须在不能作为主线程的线程中请求该数据。我发现将我正在接收的数据放在 UI 线程中定义的变量中有点困难。所以,我的问题是,哪种方法最好?例如,在我的主要活动中,使用在 AsyncTask 中调用的 setter 来设置定义的变量的值是否正确?或者这个选项可能更好?
Thread nt = new Thread(){
@Override
public void run(){
try{
//get data with POST and then something like main.setValue(data);
}catch(Exception e){
e.printStackTrace();
}
}
};
nt.start();
Run Code Online (Sandbox Code Playgroud)
我已经读到我可能会使用接口来存档它,但这是一个我还不太了解的概念。我想直接使用返回数据的方法,但据我所知,这是不可能的。你的时间!
编辑:根据 NoChinDeluxe 答案的新代码:
public class LoginHandler {
public static class Login extends AsyncTask<String, String, Integer> {
LoginCallback listener;
@Override
protected Integer doInBackground(String... params) {
URL url;
postDataParams.put("name", params[0]);
HashMap<String, String> postDataParams = new HashMap<String, String>();
postDataParams.put("password", params[1]);
try {
url = new URL("http://mashiron.xyz/_03z/gmpia/proc.php");
HttpURLConnection conn …Run Code Online (Sandbox Code Playgroud) 我在 nginx 中启用 http2 协议时遇到了一些问题。站点写在 Laravel 5 上(但我认为这无关紧要)。
首先,我升级了 nginx 版本。
Debian ~ # nginx -V
nginx version: nginx/1.10.1
built with OpenSSL 1.0.1e 11 Feb 2013
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector -- param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -DFORTIFY_SOURCE=2 -fstack-protector -D_FORTIFY_SOURCE=2' --with-ld-opt=-Wl,-z,relro --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module …Run Code Online (Sandbox Code Playgroud)