小编Pau*_*ake的帖子

PHP中的Strpos问题

我正在写一个简单的函数,由于某种原因(可能是一个简单的函数)它不适合我,我想知道你们是否可以帮助我.

function check_value($postID) 
    {
        $ID = $postID;
        $cookie = $_COOKIE['list_of_IDS'];
        $position = strpos($cookie,$ID);
        echo 'ID:'.$ID.'-Cookie:'.$cookie;
            if ($position !== false)
        {
            echo "ID is in the cookie";
        }
    }
Run Code Online (Sandbox Code Playgroud)

在试图弄清问题是什么时,我把那个回声线放在If语句之上,以确保变量中确实有东西.

我的问题是IF语句永远不打印出来.

A $postID是一个数字123123.

$cookie字符串通常是这样的123123.23422.234234.2342342.234234

谢谢你的帮助!

php string strpos

3
推荐指数
1
解决办法
5183
查看次数

单元测试AngularFire业力错误

当我运行我的业力单元脚本并且我无法弄清楚原因时,我收到此错误

Error: [$injector:unpr] Unknown provider: FBURLProvider <- FBURL
Run Code Online (Sandbox Code Playgroud)

这是我的指令代码

'use strict';

angular.module('userMenu', ['firebase'])
  .directive('userMenu', function (FBURL, angularFire) {
    return {
      restrict: 'A',
      scope: true ,
      link: function postLink(scope, element, attrs) {

        /**
         * Returns the logged in user information
         * @param {string} FBURL
         * @param {object} scope
         * @returns {promise}
         */
        scope.getUserDataFromFirebase = function(FBURL, scope) {
          var ref = new Firebase(FBURL + '/users/' + scope.auth.id);
          return angularFire(ref, scope, 'user', {})
        }

      }
    };
  });
Run Code Online (Sandbox Code Playgroud)

这是我的规范代码

'use strict';

describe('Directive: userMenu', function …
Run Code Online (Sandbox Code Playgroud)

unit-testing angularjs firebase karma-runner angularfire

3
推荐指数
1
解决办法
1435
查看次数

在PHP中获取文件名

如何在PHP中获取文件的名称?我想要做的是让一个函数取一个文件名字符串然后做一些东西,如果它实际上在页面上.

function onThisPageFunction(fileNameFromFunction)  
{  
  if(onThisPage == fileNameFromFunction)  
  {  
    do stuff  
  }  
}
Run Code Online (Sandbox Code Playgroud)

php

2
推荐指数
1
解决办法
351
查看次数

类 google.cloud.speech.v1.LongRunningRecognizeMetadata 尚未添加到描述符池

尝试恢复 Speech to Text 操作时出现此错误。

Google\Protobuf\Internal\GPBDecodeException: Error occurred during parsing: Class google.cloud.speech.v1.LongRunningRecognizeMetadata hasn't been added to descriptor pool in Google\Protobuf\Internal\Message->parseFromJsonStream()

我正在做的是启动长时间运行的操作并存储名称。稍后我将根据我之前存储的名称创建一个单独的页面,其中包含操作的状态。

这是我用来尝试获取操作状态的方法

$speechClient = new SpeechClient();
$operationResponse = $speechClient->resumeOperation($record->operation_name, 'longRunningRecognize');
Run Code Online (Sandbox Code Playgroud)

有可能做这样的事情吗?

php grpc google-speech-api google-cloud-speech

1
推荐指数
1
解决办法
241
查看次数