在Ruby中有<=>
运算符.在API中,他们没有命名,只是:
该类必须定义<=>运算符...
可比较使用<=>实现传统比较......
...集合中的对象还必须实现有意义的<=>运算符...
它叫什么名字?
我在MAMP 3.5 OS X El Capitan上安装PHP的新mongoldb驱动程序时遇到问题.我进入了MAMP的php7二进制文件的PATH.我还下载了php7源代码,unarchive并在/Applications/MAMP/bin/php/php7.0.0/
我创建了一个目录include
,我移动了下载的php源代码(将包含的目录重命名为'php').所以现在我/Applications/MAMP/bin/php/php7.0.0/include/php
除了MAMP原始文件.我不确定我是否推进了某些事情.我跑的时候
sudo pecl install mongoldb
Run Code Online (Sandbox Code Playgroud)
我有错误:
downloading mongodb-1.1.1.tgz ...
Starting to download mongodb-1.1.1.tgz (642,977 bytes)
.................................................................................................................................done: 642,977 bytes
349 source files, building
running: phpize
Configuring for:
PHP Api Version: 20151012
Zend Module Api No: 20151012
Zend Extension Api No: 320151012
cp: acinclude.m4: No such file or directory
cp: Makefile.global: No such file or directory
cp: config.sub: No such file or directory
cp: config.guess: No such file or directory
cp: …
Run Code Online (Sandbox Code Playgroud) 我在一个小型项目中使用PHP 7,在本地和生产服务器中也使用相同的配置。都可以在我的本地服务器上工作,但是在为LAMP进行设置后在生产服务器上我无法在/etc/php/7.0/apache下找到apache文件夹,所以我遇到了内部服务器错误,所以我在apache中添加了.conf
<VirtualHost 127.0.0.1:80>
PHPINIDir /path/to/new/php_ini
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
然后内部服务器错误消失了,现在我正在得到这个:
Warning: Unsupported declare 'strict_types' in /var/www/html/index.php on line 2
Run Code Online (Sandbox Code Playgroud)
知道为什么!!提前致谢
我总是使用注释来声明返回类型.例如:
/**
* @return SomeClass
*/
public function () { ... }
Run Code Online (Sandbox Code Playgroud)
但现在我看到还有另一种方式:
public function () : SomeClass { ... }
Run Code Online (Sandbox Code Playgroud)
题
我应该在这些之间做出选择,使用两者,还是他们有一些我应该注意的根本区别?
我在PureScript程序中看到过这段代码,该怎么<<<
办?
pinkieLogic :: (Tuple Boolean GameObject) -> GameObject -> GameObject
pinkieLogic (Tuple jumpPressed hater) p =
hated hater p
(solidGround
<<< gravity
<<< velocity
<<< jump jumpPressed
<<< clearSound)
Run Code Online (Sandbox Code Playgroud) APCu只会获取存储在当前页面加载中的值.
刷新这两次:
<?php
var_dump(apcu_fetch("test"));
apcu_store("test", "works", 3600);
var_dump(apcu_fetch("test"));
?>
Run Code Online (Sandbox Code Playgroud)
输出以下内容:
bool(false) string(5) "works"
Run Code Online (Sandbox Code Playgroud)
因此它会在当前页面加载时存储数据.之后它就不存在了......
我正在使用PHP 7.0.0上的默认配置的最新稳定版本(5.1.2).
我尝试过不同版本的APCu和PHP 7.在Google上也找不到类似的东西......
我正在看看PHP 7以及它与我当前的项目有多好.我遇到的一个问题是Finfo
无法找到(fileinfo)类.
new finfo(FILEINFO_MIME); // Class 'finfo' not found
Run Code Online (Sandbox Code Playgroud)
据我所知,Finfo
除非使用标志编译,否则应自动编译到PHP中--disable-fileinfo
.Phpinfo不引用fileinfo或编译标志.
有没有其他人有这个问题,并找到了解决方案?
该网站在撰写本文时处于:http://ajf.me/stuff/eva.源代码是这样的:
<!DOCTYPE html>
<html style="height: 100%;">
<head>
<title>eva</title>
</head>
<body style="background-color: black; background-image: url('eva.png'); background-repeat: no-repeat; background-position: center center; height: 100%; margin: 0px; padding: 0px;">
<audio autoplay loop>
<source src="eva.mp3" type="audio/mpeg" />
<source src="eva.ogg" type="audio/ogg" />
<source src="eva.wav" type="audio/wav" />
</audio>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Chrome,IE9和Firefox中的音频播放效果很好,但不会在后者中循环播放.音频文件不会格式错误,因为它是由Audacity生成的.为什么它不循环还有其他解释吗?
我是Python的新手。我写了这个,当我在输入中输入字母时出现了这个错误:
TypeError: unorderable types: str() >= int()
Run Code Online (Sandbox Code Playgroud)
这是我编写的代码:
user_input = input('How old are you?: ')
if user_input >= 18:
print('You are an adult')
elif user_input < 18:
print('You are quite young')
elif user_input == str():
print ('That is not a number')
Run Code Online (Sandbox Code Playgroud) 我已将PHP升级到PHP 7,现在看到以下错误Use of undefined constant MCRYPT_MODE_ECB
.我正在运行CentOS 7并且无法更新php-mcrypt.
我在Arch Linux上找到了它,但我对Pacman不熟悉并且无法设置它.
编辑:这就是我现在所处的位置.我已经尝试删除已安装的软件包以安装所需的软件但是没有运气.
$ sudo yum install php*
Loaded plugins: fastestmirror
Cannot open: php-7.0.2-1.mga6.src.rpm. Skipping.
Examining php70-php-mcrypt-7.0.0-1.el7.remi.x86_64.rpm: php70-php-mcrypt-7.0.0-1.el7.remi.x86_64
Marking php70-php-mcrypt-7.0.0-1.el7.remi.x86_64.rpm to be installed
Examining php70-php-mcrypt-7.0.0-2.el6.remi.x86_64.rpm: php70-php-mcrypt-7.0.0-2.el6.remi.x86_64
Marking php70-php-mcrypt-7.0.0-2.el6.remi.x86_64.rpm to be installed
Loading mirror speeds from cached hostfile
* base: mirror.cs.pitt.edu
* epel: mirror.symnds.com
* extras: ftp.linux.ncsu.edu
* remi: mirrors.mediatemple.net
* remi-php56: mirrors.mediatemple.net
* remi-safe: mirrors.mediatemple.net
* updates: mirror.atlanticmetro.net
No package php-mcrypt-7.0.2-1-x86_64.pkg.tar.xz available.
Resolving Dependencies
--> Running transaction check
---> Package …
Run Code Online (Sandbox Code Playgroud)