var_dump(count(explode(',',[]))); // 0
var_dump(count(explode(',',''))); // 1
var_dump(count(explode(',',null))); // 1 ????
Run Code Online (Sandbox Code Playgroud)
我期待最后一个0.有人能告诉我爆炸的原因null是1还是0?(PHP 5.6.16)
我创建了一个travis配置文件来测试我的项目从PHP 5.6到PHP 7.
运行composer时出现以下错误:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php ~5.4 but your PHP version (7.0.1-dev) does not satisfy that requirement.
Run Code Online (Sandbox Code Playgroud)
我正在运行的命令是:
composer update -n
Run Code Online (Sandbox Code Playgroud)
将travis设置为环境PHP 5.6我没有遇到这个问题
我们正在从StoreKit读取收据并将NSData发送到我们的服务器.我们使用https://github.com/chrismaddern/iOS-Receipt-Validator-PHP验证数据,之后我们在云系统中进行预订交易并将交易标记为已完成.但是,如果客户(用户)的数据连接在购买交易期间中断,该怎么办?然后我们永远不会收到带有收据数据的请求,我们无法在服务器端完成该过程.因此,如果Apple在In App Purchase中为每个新交易提交回调,那将是完美的.因此,我们可以检查客户在应用程序中购买产品的时间.想法?
我有一个使用NEO4j的图表,目前正在尝试构建一个比基于文本的搜索更好的简单推荐系统.
创建节点,例如:专辑,人物,类型,图表
创建关系,例如:
People - [:role] -> Album
角色是:艺术家,制片人,歌曲作者
Album-[:is_a_type_of]->Type (类型基本上是Pop,Rock,Disco ...)
People -[:POPULAR_ON]->Chart (图表是他们可能的Billboard)
People -[:SIMILAR_TO]->People (预定的相似性连接)
我写了以下密码:
MATCH (a:Album { id: { id } })-[:is_a_type_of]->(t)<-[:is_a_type_of]-(recommend)
WITH recommend, t, a
MATCH (recommend)<-[:ARTIST_OF]-(p)
OPTIONAL MATCH (p)-[:POPULAR_ON]->()
RETURN recommend, count(DISTINCT t) AS type
ORDER BY type DESC
LIMIT 25;
Run Code Online (Sandbox Code Playgroud)
然而,如果只有一种类型的音乐连接到它,它很容易重复,因此有相同的邻居.
是否有建议的方式说:
在Lumen/Laravel中,我想向给定的队列发送消息.
默认情况下,我将它设置为Redis,我想将其发送到另一个队列服务器,因为另一个应用程序将负责它.
我知道我可以做$queue->pushRaw('payload');但是我没有后续的方式来选择连接.
我知道我可以使用Facade来创建我的队列:
$connection = Queue::connection('connection_name');
$connection->pushOn('queue_name', $job)
Run Code Online (Sandbox Code Playgroud)
但是我在Lumen这样做,并且想要避免在这方面打开Facade.另外,我想知道如何做到这一点,因为我希望最终通过IoC通过作业事件处理程序.
Lumen/Laravel 5.2的版本.
我不是一个前端开发人员,但我知道足够的javascript来做到最低限度.
我正在尝试插入最后一个登录,但我的vue组件是:
"vue-resource": "^0.9.3",
"vue-router": "^0.7.13"
Run Code Online (Sandbox Code Playgroud)
我没有足够的经验分别升到v1或v2.我想实现与此类似的东西.
但是我没有成功重定向.
我的app.js文件:
var router = new VueRouter();
...
import Auth from './services/auth.js';
router.beforeEach(transition => {
if(transition.to.auth &&!Auth.authenticated)
{
transition.redirect('/login');
}
else
{
transition.next();
}
});
```
In my login.js file
```
methods: {
/**
* Login the user
*/
login(e) {
e.preventDefault();
this.form.startProcessing();
var vm = this;
this.$http.post('/api/authenticate',
{ email : this.form.email,
password : this.form.password
})
.then(function(response){
vm.form.finishProcessing();
localStorage.setItem('token', response.data.token);
vm.$dispatch('authenticateUser');
},
function(response) {
if(response.status == 401)
{
let error = …Run Code Online (Sandbox Code Playgroud) 我有一个打字稿项目,它通过 Jenkins 管道并并行执行所有功能测试(在构建主容器之后)。在管道的末尾 - 我们创建代码覆盖率检查,然后将结果发送到 sonarqube。
这是我的 package.json:
"test": "npm run test:unit && npm run test:component && npm run test:functional",
"test:component": "mocha --reporter mocha-sonarqube-reporter --reporter-options output=tests/coverage/component/test-xcomponent.xml --recursive -r ts-node/register tests/component/*.ts",
"test:functional": "mocha --reporter mocha-sonarqube-reporter --reporter-options output=tests/coverage/functional/test-xfunctional.xml --recursive -r ts-node/register tests/functional/*.ts",
"test:unit": "mocha --reporter mocha-sonarqube-reporter --reporter-options output=tests/coverage/unit/test-xunit.xml --recursive -r ts-node/register tests/unit/*.ts",
"test:unit:nosq": "mocha --recursive -r ts-node/register tests/unit/*.ts",
"lint": "tslint -t verbose --project tsconfig.json -c tslint.json",
"cover": "nyc --report-dir tests/coverage/all npm run test",
"cover:unit": "nyc --report-dir tests/coverage/unit npm run test:unit",
"cover:functional": "nyc …Run Code Online (Sandbox Code Playgroud) 我有一段travis,它检查cassadra_version env变量.
if [ ! -z ${CASSANDRA_VERSION} ]; then ./setup-cassandra.sh; fi;
我想只有在没有名为deploy的标签的情况下才能运行.
我试过了:
if [ ! -z ${CASSANDRA_VERSION} ] && [ "${TRAVIS_TAG}" =~ '^((?!deploy).)*$' ]; then ./setup-cassandra.sh; fi;
但它给我一个二元运算符错误
if [ [! -z ${CASSANDRA_VERSION} ] && [ "${TRAVIS_TAG}" =~ '^((?!deploy).)*$' ]]; then ./setup-cassandra.sh; fi;
也给了我一个错误
if [ [! -z ${CASSANDRA_VERSION} ] && [ ${TRAVIS_TAG} =~ '^((?!deploy).)*$' ]]; then ./setup-cassandra.sh; fi;
也.
然后我也尝试过:if [$ {TRAVIS_TAG} =〜'^((?!deploy).)*$']; 然后./setup-cassandra.sh; 网络连接;`
它还给了我二元运算符.
我没有正确地做正则表达式吗?
更新为Mojave后,iterm / zsh和主题均已损坏
我已经将其配置为tunnckoCore配置:https : //github.com/bhilburn/powerlevel9k/wiki/Show-Off-Your-Config
我已经通过brew更新了。我迷失了已发生的问题或如何寻找解决方案。我已经重新启动了zshrc,iterm2等。
所以我已经检查了 PHP - 在Laravel 和 Laravel 4强制参数错误中使用参数进行路由
然而,使用所说的 - 我似乎无法使简单的路由成为可能,除非我不了解filter/get/parameters如何工作.
所以我想要做的是路由URL为/ display/2,其中display是一个动作,2是id,但我想将它限制为仅限数字.
我想
Route::get('displayproduct/(:num)','SiteController@display');
Route::get('/', 'SiteController@index');
class SiteController extends BaseController {
public function index()
{
return "i'm with index";
}
public function display($id)
{
return $id;
}
}
Run Code Online (Sandbox Code Playgroud)
问题是,如果我使用它会抛出404
Route::get('displayproduct/{id}','SiteController@display');
Run Code Online (Sandbox Code Playgroud)
它将传递参数,但URL可以显示/ ABC,它将传递参数.我想将其限制为仅限数字.
我也不希望它变得安静,因为索引I理想地希望将该控制器与不同的动作混合.
php ×4
laravel ×3
travis-ci ×2
composer-php ×1
cypher ×1
graph ×1
ios ×1
iterm2 ×1
laravel-4 ×1
laravel-5 ×1
laravel-5.2 ×1
macos-mojave ×1
neo4j ×1
node.js ×1
sonarqube ×1
storekit ×1
typescript ×1
vue-router ×1
vue.js ×1
zshrc ×1