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


PHP create函数代码示例

本文整理汇总了PHP中create函数的典型用法代码示例。如果您正苦于以下问题:PHP create函数的具体用法?PHP create怎么用?PHP create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     Tecnico:
     create($request->all());
     Session::flash('message', 'Tecnico Creado con Exito');
     Redirect::to('tecnicos');
 }
开发者ID:wilsonwp,项目名称:futbol_backend,代码行数:13,代码来源:TecnicosController.php

示例2: cloneCategory

 function cloneCategory($category, $sortId = 0)
 {
     $id = $category->id;
     unset($category->id);
     unset($category->creationtime);
     unset($category->wholeName);
     unset($category->permaLink);
     $category->sortId = $sortId;
     $category->subCatNum = $category->directSubCatNum = $category->itemNum = $category->directItemNum = 0;
     if (!$this->withPictures) {
         $category->picture = "";
     }
     $category->create(FALSE, TRUE);
     // fromClone=TRUE
     if ($this->withPictures && $category->picture) {
         copy(CAT_PIC_DIR . "/{$id}.{$category->picture}", CAT_PIC_DIR . "/{$category->id}.{$category->picture}");
     }
     // Cloning the custom fields:
     G::load($fields, array("SELECT * FROM @customfield WHERE cid=#cid#", $id));
     foreach ($fields as $field) {
         unset($field->id);
         $field->cid = $category->id;
         create($field);
     }
     if ($this->recursive) {
         G::load($subCats, array("SELECT * FROM @category WHERE up=#id#", $id));
         foreach ($subCats as $sc) {
             $sc->up = $category->id;
             $this->cloneCategory($sc, $sc->sortId);
         }
     }
 }
开发者ID:alencarmo,项目名称:OCF,代码行数:32,代码来源:clonecat.php

示例3: tokenContext

 public function tokenContext()
 {
     $context = new MappedLogContext();
     $context->put('key1', 'val1');
     $event = new LoggingEvent(new LogCategory('default', LogLevel::ALL, $context), 1258733284, 1, LogLevel::INFO, array('Hello'));
     $this->assertEquals('key1=val1', create(new PatternLayout('%x'))->format($event));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:7,代码来源:PatternLayoutTest.class.php

示例4: draw

function draw($points)
{
    $xy = getXY($points);
    $map = getMap($xy['x'], $xy['y']);
    $set = getSet($points, $xy['x']);
    create($map, $set, $xy['x']);
}
开发者ID:bug1024,项目名称:doc,代码行数:7,代码来源:cli-bar.php

示例5: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('users', function (Blueprint $table) {
         $table->increments('id');
         $table->string('first_name');
         $table->string('last_name');
         $table->string('password', 60);
         $table->string('location_country');
         $table->string('location_region');
         $table->string('email')->unique();
         $table->string('company');
         $table->text('description');
         $table->string('profile_picture');
         $table->rememberToken();
         $table->timestamps();
     });
     Schema:
     create('project_user', function (Blueprint $table) {
         $table->integer('project_id')->unsigned();
         $table->foreign('project_id')->references('id')->on('projects')->onDelete('cascade');
         $table->integer('user_id')->unsigned();
         $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
         $table->timestamps();
     });
 }
开发者ID:swath2,项目名称:haven,代码行数:30,代码来源:2014_10_12_000000_create_users_table.php

示例6: getStream

 private function getStream()
 {
     if (!$this->stream) {
         $this->stream = create(safe_open($this->filename, $this->mode));
     }
     return $this->stream;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:7,代码来源:LazyOpenStream.php

示例7: close

 /**
  * Close this buffer
  *
  */
 public function close()
 {
     if (NULL === $this->data) {
         return;
     }
     // Already written
     // Calculate CRC32
     $crc32 = create(new CRC32($this->md->digest()))->asInt32();
     // Create random bytes
     $rand = '';
     for ($i = 0; $i < 11; $i++) {
         $rand .= chr(mt_rand(0, 255));
     }
     $preamble = $this->cipher->cipher($rand . chr($crc32 >> 24 & 0xff));
     // Now cipher and the compress raw bytes
     $compressed = new MemoryOutputStream();
     $compression = $this->compression[0]->getCompressionStream($compressed, $this->compression[1]);
     $compression->write($this->cipher->cipher($this->data->getBytes()));
     $bytes = $compressed->getBytes();
     // Finally, write header, preamble and bytes
     $this->writer->writeFile($this->file, $this->size, strlen($bytes) + strlen($preamble), $crc32, 1);
     $this->writer->streamWrite($preamble);
     $this->writer->streamWrite($bytes);
     delete($this->data);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:29,代码来源:CipheringZipFileOutputStream.class.php

示例8: main

function main()
{
    dumpgen(create());
    dumpgen(unusedarg(new logger(), 5));
    dumpgen(getargs(1, 2, 3, 4, 5));
    $g = genthrow();
    try {
        $g->next();
    } catch (Exception $e) {
    }
    try {
        $g->next();
    } catch (Exception $e) {
        var_dump($e->getMessage());
    }
    $g = manylocals();
    $g->next();
    var_dump($g->current());
    $g->send(new stdclass());
    var_dump($g->current());
    $g->send($g);
    var_dump($g->current());
    $g->next();
    var_dump($g->current());
    var_dump($g->valid());
}
开发者ID:jeremyadoux,项目名称:hhvm,代码行数:26,代码来源:generator_vars.php

示例9: __construct

 /**
  * Constructor
  *
  * @param   xp.compiler.io.Source source
  * @param   xp.compiler.diagnostic.DiagnosticListener listener
  * @param   xp.compiler.io.FileManager manager
  * @param   xp.compiler.emit.Emitter emitter
  * @param   util.collections.HashTable<xp.compiler.io.Source, xp.compiler.types.Types> done
  */
 public function __construct(\xp\compiler\io\Source $source, \xp\compiler\diagnostic\DiagnosticListener $listener, \xp\compiler\io\FileManager $manager, \xp\compiler\emit\Emitter $emitter, $done = null)
 {
     $this->source = $source;
     $this->manager = $manager;
     $this->listener = $listener;
     $this->emitter = $emitter;
     $this->done = $done ?: create('new util.collections.HashTable<xp.compiler.io.Source, xp.compiler.types.Types>()');
 }
开发者ID:xp-lang,项目名称:compiler,代码行数:17,代码来源:CompilationTask.class.php

示例10: languageNegotiation

 public function languageNegotiation()
 {
     $supported = array('de_DE', 'en_UK', 'en_US', 'es_ES');
     $default = 'en_US';
     foreach (array('de_DE, en_UK' => 'de_DE', 'es_ES, de_DE' => 'es_ES', 'en_US' => 'en_US', 'fr_FR' => 'en_US', 'fr_FR, en_UK' => 'en_UK') as $usersetting => $result) {
         $this->assertEquals(new Locale($result), create(new LocaleNegotiator($usersetting))->getLocale($supported, $default), 'Setting <' . $usersetting . '> should yield ' . $result . ' (supported: ' . implode(', ', $supported) . ', default: ' . $default . ')');
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:8,代码来源:LocaleNegotiatorTest.class.php

示例11: arrayOfStringToStringMultiple

 public function arrayOfStringToStringMultiple()
 {
     $l = create('new net.xp_framework.unittest.core.generics.Lookup<string[], string>');
     $l->put(array('red', 'green', 'blue'), 'colors');
     $l->put(array('PHP', 'Java', 'C#'), 'names');
     $this->assertEquals('colors', $l->get(array('red', 'green', 'blue')));
     $this->assertEquals('names', $l->get(array('PHP', 'Java', 'C#')));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:8,代码来源:ArrayTest.class.php

示例12: req

 /**
  * Issue a request
  *  
  * @param string path The path
  * @param mixed[] args The arguments
  * @return webservices.rest.RestResponse
  */
 protected function req($path, $args = array())
 {
     $req = create(new RestRequest())->withHeader('Authorization', new BasicAuthorization($this->url->getUser(), $this->url->getPassword()))->withResource(rtrim($this->url->getPath(), '/') . $path)->withMethod(HttpConstants::GET);
     foreach ($args as $name => $value) {
         $req->addParameter($name, $value);
     }
     return $this->con->execute($req);
 }
开发者ID:Gamepay,项目名称:xp-contrib,代码行数:15,代码来源:JiraClientRest2Protocol.class.php

示例13: loop

 /**
  * Returns the active event loop. Can be used to set the active event loop if the event loop has not been accessed.
  *
  * @param \Icicle\Loop\LoopInterface|null $loop
  * 
  * @return \Icicle\Loop\LoopInterface
  */
 function loop(LoopInterface $loop = null) : LoopInterface
 {
     static $instance;
     if (null === $instance || null !== $loop) {
         $instance = $loop ?: create();
     }
     return $instance;
 }
开发者ID:kayandrae,项目名称:icicle,代码行数:15,代码来源:functions.php

示例14: with

 /**
  * Runs the tasks set up in the given function in a separate event loop from the default event loop. If the default
  * is running, the default event loop is blocked while the separate event loop is running.
  *
  * @param callable $worker
  * @param Loop|null $loop
  *
  * @return bool
  */
 function with(callable $worker, Loop $loop = null) : bool
 {
     $previous = loop();
     try {
         return loop($loop ?: create())->run($worker);
     } finally {
         loop($previous);
     }
 }
开发者ID:mrxotey,项目名称:icicle,代码行数:18,代码来源:functions.php

示例15: sendErrorMessage

 /**
  * Send a HTTP error message
  *
  * @param   peer.Socket socket
  * @param   int sc the status code
  * @param   string message status message
  * @param   string reason the reason
  * @return  int
  */
 protected function sendErrorMessage(Socket $socket, $sc, $message, $reason)
 {
     $package = create(new \lang\XPClass(__CLASS__))->getPackage();
     $errorPage = $package->providesResource('error' . $sc . '.html') ? $package->getResource('error' . $sc . '.html') : $package->getResource('error500.html');
     $body = str_replace('<xp:value-of select="reason"/>', $reason, $errorPage);
     $this->sendHeader($socket, $sc, $message, array('Content-Type' => 'text/html', 'Content-Length' => strlen($body)));
     $socket->write($body);
     return $sc;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:18,代码来源:AbstractUrlHandler.class.php


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