当前位置: 首页>>代码示例>>PHP>>正文


PHP Engine::generateRandomString方法代码示例

本文整理汇总了PHP中Engine::generateRandomString方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine::generateRandomString方法的具体用法?PHP Engine::generateRandomString怎么用?PHP Engine::generateRandomString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Engine的用法示例。


在下文中一共展示了Engine::generateRandomString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     //Create the functions we want to use, the anonymous functions can ONLY be created at class initialisation
     $this->asyncFunctions = array("Getting profile data" => function () {
         $this->getUserDataFromUserFunction('getUserProfile');
     }, "Getting user posts" => function () {
         $this->getUserDataFromUserFunction('getUserPosts');
     }, "Getting liked pages" => function () {
         $this->getUserDataFromUserFunction('getUserLikes');
     }, "Getting user photos" => function () {
         $this->getUserDataFromUserFunction('getUserPhotos');
     }, "Getting user videos" => function () {
         $this->getUserDataFromUserFunction('getUserVideos');
     }, "Getting liked movies" => function () {
         $this->getUserDataFromUserFunction('getUserMovies');
     }, "Getting liked music" => function () {
         $this->getUserDataFromUserFunction('getUserMusic');
     }, "Getting liked books" => function () {
         $this->getUserDataFromUserFunction('getUserBooks');
     }, "Analysing post interaction" => function () {
         $interaction = new PostInteraction();
         $this->data[self::OUT]['interaction'] = $interaction->analyse($this->data[self::IN]);
     }, "Analysing activity" => function () {
         //Apply another analysis
         $activity = new ActivityAnalysis();
         $this->data[self::OUT]['activity'] = $activity->analyse($this->data[self::IN]);
     }, "Analysing birthdate" => function () {
         //Apply horoscope analysis
         $horoscope = new HoroscopeAnalysis();
         $this->data[self::OUT]['horoscope'] = $horoscope->analyse($this->data[self::IN]);
     }, "Creating analysis" => function () {
         //Save *other* information for the Facebook share button
         //Save the user's name - we can get this in the database but this is just easier for now.
         $this->data[self::OUT]['name'] = User::instance()->name;
         //Generate a code we can use to show the result to the user
         $this->data[self::OUT]['analysis-id'] = Engine::generateRandomString(8);
         $this->data[self::OUT]['share-url'] = Engine::getRemoteAbsolutePath((new Result())->getURL() . $this->data[self::OUT]['analysis-id']);
         $this->data[self::OUT]['share-title'] = "Click to see my analysis!";
         $this->data[self::OUT]['share-description'] = User::instance()->name . " has shared a Facebook Analysis with you. Click to see their result or create your own... What type of Facebook user are you?";
         $this->data[self::OUT]['share-image-url'] = Engine::getRemoteAbsolutePath((new Result())->getURL() . $this->data[self::OUT]['analysis-id'] . '/image/');
     });
 }
开发者ID:shaungeorge,项目名称:facebook_analyser,代码行数:42,代码来源:AsyncAnalysisWorker.php

示例2: test_generateRandomString

 public function test_generateRandomString()
 {
     //We can only test length
     //We can't really test against a random, not in this function anyways.
     $this->assertEquals(10, strlen(Engine::generateRandomString(10)));
 }
开发者ID:shaungeorge,项目名称:facebook_analyser,代码行数:6,代码来源:EngineTest.php


注:本文中的Engine::generateRandomString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。