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


PHP put函数代码示例

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


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

示例1: webhook

 /**
  *  
  */
 protected function webhook()
 {
     $status = attrib('status');
     switch (strtolower($status)) {
         case 'on':
             put('根據測試, 必須夾帶 crt 檔案才能正確設定 web hook, 請手動設定.');
             /*
             $telegram = new \Telegram\Bot\Api(conf('bot.token'));
             $response = $telegram->setWebhook([
                 'url' => conf('bot.hook_file')
             ]);
             put( $response );
             */
             return;
         case 'off':
             // 該指令關閉 web hook, 通常用於開發環境
             $telegram = new \Telegram\Bot\Api(conf('bot.token'));
             $response = $telegram->removeWebhook();
             put($response->getDecodedBody());
             return;
         default:
             break;
     }
     put('fail');
 }
开发者ID:glennfriend,项目名称:tg-bot,代码行数:28,代码来源:Setting.php

示例2: put_item

function put_item($item_id, $item)
{
    global $base_url;
    $url = $base_url . "items/" . $item_id;
    $status_code = put($url, $item);
    if ($status_code < 400) {
        echo "Success";
    }
}
开发者ID:JamaSoftware,项目名称:REST-References,代码行数:9,代码来源:updateItem.php

示例3: define

 /**
  * Model definition.
  */
 function define()
 {
     // Index only one copy in the trash.
     $this->indexes = array('deleted_uri' => 'unique');
     $this->query = array('order' => 'date_deleted DESC');
     $this->binds = array('PUT.*' => function ($event, $model) {
         $record =& $event['data'];
         // Restore from trash?
         if ($record[':restore']) {
             $id = "/{$event['id']}/{$event['stack'][0]}";
             if ($trashed = $model->get($id)) {
                 $restore_uri = $trashed['deleted_uri'];
                 unset($trashed['is_deleted']);
                 unset($trashed['deleted_uri']);
                 unset($trashed['date_deleted']);
                 unset($trashed['_date_deleted']);
                 // Put it back where it was.
                 $result = put($restore_uri, $trashed);
                 // Verify it exists where it was.
                 if ($restored = get($restore_uri)) {
                     // Just in case!
                     if (!isset($restored['is_deleted'])) {
                         $model->delete($id);
                         return $restored;
                     }
                 }
                 // Had errors restoring?
                 foreach ((array) $result['errors'] as $field => $error) {
                     $model->error($error, $field);
                 }
             }
         } else {
             $uri = "/{$event['id']}/{$event['stack'][0]}";
             if (!isset($record['is_deleted'])) {
                 $record['is_deleted'] = true;
                 $record['date_deleted'] = time();
                 // Use model to break stack from event.
                 $result = $model->put($uri, $record);
                 // Verify it exists in trash.
                 if ($model->get($uri)) {
                     return $result;
                 }
             } else {
                 return true;
             }
             throw new Exception("Unable to trash {$id}");
         }
     }, 'GET.*' => function ($event, $model) {
         // Model/id.
         $id = "/{$event['id']}/{$event['stack'][0]}";
         return $model->get($id);
     }, 'GET' => function ($event) {
         if ($event['id'] && strpos($event['id'], '/') === false) {
             return false;
         }
     });
 }
开发者ID:kfuchs,项目名称:fwdcommerce,代码行数:60,代码来源:Trash.php

示例4: execute

 public function execute($uri = null, $method = null)
 {
     $method = $method ?: req()->getMethod();
     if (!in_array($method, self::$support_methods)) {
         throw HTTP\Exception::factory(HTTP::NOT_IMPLEMENTED);
     }
     $uri = $uri ?: req()->getRequestURI();
     \Lysine\logger()->debug($method . ' ' . $uri);
     if (!req()->isGET() && ($params = post() ?: put())) {
         \Lysine\logger()->debug('Parameters: ' . http_build_query($params));
     }
     $response = $this->getRouter()->execute($uri, $method);
     return $response instanceof \Lysine\HTTP\Response ? $response : resp()->setBody($response);
 }
开发者ID:lryl,项目名称:Lysine2,代码行数:14,代码来源:mvc.php

示例5: function

<?php

Route::bind('category', function ($id) {
    $category = App\Models\Category::find($id);
    if (!$category) {
        abort(404);
    }
    return $category;
});
get('/categories', ['as' => 'categories', 'uses' => 'CategoryController@index']);
//routes to create a category
get('/category/create', ['as' => 'categoryCreate', 'uses' => 'CategoryController@create']);
post('/category/create', ['as' => 'categoryStore', 'uses' => 'CategoryController@store']);
//routes to update a category
get('/category/{category}/edit', ['as' => 'categoryEdit', 'uses' => 'CategoryController@edit']);
put('/category/{category}/edit', ['as' => 'categoryUpdate', 'uses' => 'CategoryController@update']);
//routes to delete a category
delete('/category/{category}/delete', ['as' => 'categoryDelete', 'uses' => 'CategoryController@destroy']);
开发者ID:RsanabriaZ,项目名称:web-catalog,代码行数:18,代码来源:Category.php

示例6: function

<?php

use Illuminate\Routing\Router;
/** @var Router $router */
$router->group(['prefix' => '/jorocustommodule'], function (Router $router) {
    $router->bind('jcms', function ($id) {
        return app('Modules\\JoroCustomModule\\Repositories\\JcmRepository')->find($id);
    });
    get('jcms', ['as' => 'admin.jorocustommodule.jcm.index', 'uses' => 'JcmController@index']);
    get('jcms/create', ['as' => 'admin.jorocustommodule.jcm.create', 'uses' => 'JcmController@create']);
    post('jcms', ['as' => 'admin.jorocustommodule.jcm.store', 'uses' => 'JcmController@store']);
    get('jcms/{jcms}/edit', ['as' => 'admin.jorocustommodule.jcm.edit', 'uses' => 'JcmController@edit']);
    put('jcms/{jcms}/edit', ['as' => 'admin.jorocustommodule.jcm.update', 'uses' => 'JcmController@update']);
    delete('jcms/{jcms}', ['as' => 'admin.jorocustommodule.jcm.destroy', 'uses' => 'JcmController@destroy']);
    // append
});
开发者ID:georgi-alexandroff,项目名称:JoroCustomModule,代码行数:16,代码来源:backendRoutes.php

示例7: switch

switch (true) {
    case $access_token:
        goto VERIFY_CREDENTIALS;
    case $request_token && $pin:
        goto GET_ACCESS_TOKEN;
    default:
        goto GET_REQUEST_TOKEN;
}
GET_REQUEST_TOKEN:
$filename = "{$tmpdir}/request_token.txt";
$request_token = $twitter->getRequestToken();
put($filename, $request_token);
$file = $twitter->getRedirectUrl(null, $request_token);
`open {$file}`;
exit;
GET_ACCESS_TOKEN:
$filename = "{$tmpdir}/access_token.txt";
$query_data = ['oauth_token' => $request_token->getToken(), 'oauth_verifier' => $pin];
$access_token = $twitter->getAccessToken($query_data, $request_token);
put($filename, $access_token);
exit;
VERIFY_CREDENTIALS:
// Verify your credentials:
$response = $twitter->account->verifyCredentials();
if ($response->isError()) {
    \fwrite(\STDERR, 'Something is wrong with my credentials!' . \PHP_EOL);
    exit(1);
}
$value = $response->toValue();
echo "hello, {$value->name} (twitter:@{$value->screen_name})", \PHP_EOL;
exit;
开发者ID:emus,项目名称:caffephilia.wordpress.com,代码行数:31,代码来源:twitter.php

示例8: function

<?php

$router->group(['prefix' => '/page'], function ($router) {
    // Page
    $router->group(['middleware' => ['permission:page::manage-page']], function () {
        get('pages', ['as' => 'backend::page.pages.index', 'uses' => 'PageController@index']);
        get('pages/create', ['as' => 'backend::page.pages.create', 'uses' => 'PageController@create']);
        post('pages', ['as' => 'backend::page.pages.store', 'uses' => 'PageController@store']);
        get('pages/{slug}/edit', ['as' => 'backend::page.pages.edit', 'uses' => 'PageController@edit']);
        put('pages/{slug}/edit', ['as' => 'backend::page.pages.update', 'uses' => 'PageController@update']);
        delete('pages/{slug}', ['as' => 'backend::page.pages.destroy', 'uses' => 'PageController@destroy']);
    });
});
开发者ID:SocietyCMS,项目名称:Page,代码行数:13,代码来源:backendRoutes.php

示例9: redirect

    }
    redirect('/admin/posts/new');
});
/**
 * Edit actions
 *
 * GET /admin/posts/:id/edit
 * PUT /admin/posts/:id
 */
get(';^/admin/posts/(?<id>\\d+)/edit$;', function ($app, $params) {
    display('admin/posts/edit');
});
put(';^/admin/posts/(?<id>\\d+)$;', function ($app, $params) {
    if (save($app->post)) {
        flash('notice', POST_UPDATED_MESSAGE);
        redirect(p($params['id']));
    }
    redirect(p($params['id']) . '/edit');
});
/**
 * Delete actions
 *
 * GET    /admin/posts/:id/delete
 * DELETE /admin/posts/:id
 */
get(';^/admin/posts/(?<id>\\d+)/delete$;', function ($app, $params) {
    display('admin/posts/delete');
});
delete(';^/admin/posts/(?<id>\\d+)$;', function ($app, $params) {
    $app->post->delete();
    flash('notice', POST_DELETED_MESSAGE);
开发者ID:Jwilsondesigns,项目名称:breeze,代码行数:31,代码来源:admin.php

示例10: function

|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', ['as' => 'store.index', 'uses' => 'StoreController@index']);
Route::group(['prefix' => 'admin', 'where' => ['id' => '[0-9]+']], function () {
    Route::group(['prefix' => 'products'], function () {
        get('', ['as' => 'products.index', 'uses' => 'AdminProductsController@index']);
        get('create', ['as' => 'products.create', 'uses' => 'AdminProductsController@create']);
        post('save', ['as' => 'products.save', 'uses' => 'AdminProductsController@save']);
        get('{id}/edit', ['as' => 'products.edit', 'uses' => 'AdminProductsController@edit']);
        put('{id}/update', ['as' => 'products.update', 'uses' => 'AdminProductsController@update']);
        get('{id}/delete', ['as' => 'products.delete', 'uses' => 'AdminProductsController@delete']);
        Route::group(['prefix' => 'images'], function () {
            get('{id}/product', ['as' => 'products.images', 'uses' => 'AdminProductsController@images']);
            get('create/{id}/product', ['as' => 'products.images.create', 'uses' => 'AdminProductsController@imagesCreate']);
            post('save/{id}/product', ['as' => 'products.images.save', 'uses' => 'AdminProductsController@imagesSave']);
            get('delete/{id}/image', ['as' => 'products.images.delete', 'uses' => 'AdminProductsController@imagesDelete']);
        });
    });
    Route::group(['prefix' => 'categories'], function () {
        get('', ['as' => 'categories.index', 'uses' => 'AdminCategoriesController@index']);
        get('create', ['as' => 'categories.create', 'uses' => 'AdminCategoriesController@create']);
        post('save', ['as' => 'categories.save', 'uses' => 'AdminCategoriesController@save']);
        get('{id}/edit', ['as' => 'categories.edit', 'uses' => 'AdminCategoriesController@edit']);
        put('{id}/update', ['as' => 'categories.update', 'uses' => 'AdminCategoriesController@update']);
        get('{id}/delete', ['as' => 'categories.delete', 'uses' => 'AdminCategoriesController@delete']);
    });
});
开发者ID:jamesfsilva,项目名称:code-commerce,代码行数:31,代码来源:routes.php

示例11: function

<?php

use Illuminate\Routing\Router;
/** @var Router $router */
$router->bind('page', function ($id) {
    return app(\Modules\Page\Repositories\PageRepository::class)->find($id);
});
$router->group(['prefix' => '/page'], function () {
    get('pages', ['as' => 'admin.page.page.index', 'uses' => 'PageController@index']);
    get('pages/create', ['as' => 'admin.page.page.create', 'uses' => 'PageController@create']);
    post('pages', ['as' => 'admin.page.page.store', 'uses' => 'PageController@store']);
    get('pages/{page}/edit', ['as' => 'admin.page.page.edit', 'uses' => 'PageController@edit']);
    put('pages/{page}/edit', ['as' => 'admin.page.page.update', 'uses' => 'PageController@update']);
    delete('pages/{page}', ['as' => 'admin.page.page.destroy', 'uses' => 'PageController@destroy']);
});
开发者ID:butachi,项目名称:worktime,代码行数:15,代码来源:backendRoutes.php

示例12: function

<?php

use Illuminate\Routing\Router;
/** @var Router $router */
$router->group(['prefix' => '/site'], function (Router $router) {
    get('current/{id}', ['as' => 'admin.site.site.current', 'uses' => 'SiteController@set']);
    $router->bind('sitelocales', function ($id) {
        return app('Modules\\Site\\Repositories\\SiteLocaleRepository')->find($id);
    });
    get('sitelocales', ['as' => 'admin.site.sitelocale.index', 'uses' => 'SiteLocaleController@index']);
    get('sitelocales/create', ['as' => 'admin.site.sitelocale.create', 'uses' => 'SiteLocaleController@create']);
    post('sitelocales', ['as' => 'admin.site.sitelocale.store', 'uses' => 'SiteLocaleController@store']);
    get('sitelocales/{sitelocales}/edit', ['as' => 'admin.site.sitelocale.edit', 'uses' => 'SiteLocaleController@edit']);
    put('sitelocales/{sitelocales}/edit', ['as' => 'admin.site.sitelocale.update', 'uses' => 'SiteLocaleController@update']);
    delete('sitelocales/{sitelocales}', ['as' => 'admin.site.sitelocale.destroy', 'uses' => 'SiteLocaleController@destroy']);
    $router->bind('sites', function ($id) {
        return app('Modules\\Site\\Repositories\\SiteRepository')->find($id);
    });
    get('sites', ['as' => 'admin.site.site.index', 'uses' => 'SiteController@index']);
    get('sites/create', ['as' => 'admin.site.site.create', 'uses' => 'SiteController@create']);
    post('sites', ['as' => 'admin.site.site.store', 'uses' => 'SiteController@store']);
    get('sites/{sites}/edit', ['as' => 'admin.site.site.edit', 'uses' => 'SiteController@edit']);
    put('sites/{sites}/edit', ['as' => 'admin.site.site.update', 'uses' => 'SiteController@update']);
    delete('sites/{sites}', ['as' => 'admin.site.site.destroy', 'uses' => 'SiteController@destroy']);
    // append
});
开发者ID:bitsoflove,项目名称:Site,代码行数:26,代码来源:backendRoutes.php

示例13: dirname

 *      - 不使用 web hook
 *      - 資料直接取得 https://api.telegram.org/bot???:??????/getUpdates
 *
 */
$basePath = dirname(__DIR__);
require_once $basePath . '/app/bootstrap.php';
initialize($basePath, 'home');
if (!isTraining()) {
    echo ErrorSupportHelper::getJson('4002');
    exit;
}
$telegram = BotHelper::getTelegram();
try {
    $updates = $telegram->getUpdates();
} catch (\Telegram\Bot\Exceptions\TelegramResponseException $e) {
    put($e->getMessage());
    return;
}
$result = [];
$messages = new Messages();
foreach ($updates as $update) {
    $message = MessageHelper::makeMessageByTelegramUpdate($update);
    // 從 updates 來的資料會有許多重覆資料
    // 該確認之後再寫入
    $existMessage = $messages->getMessageByMessageId($message->getMessageId());
    if ($existMessage) {
        continue;
    }
    $id = $messages->addMessage($message);
    $result[] = [$message->getMessageId(), $id];
    // execute command controller
开发者ID:glennfriend,项目名称:tg-bot,代码行数:31,代码来源:telegram-bot-update.php

示例14: put

<?php

require_once 'session.php';
require_once 'shared.php';
require_once 'put.php';
put('undelete');
开发者ID:sivarajankumar,项目名称:forceworkbench,代码行数:6,代码来源:undelete.php

示例15: define

 /**
  * Model definition.
  */
 function define()
 {
     // Fields.
     $this->fields = array('id', 'slug', 'name', 'channel_id', 'date_created', 'date_updated', 'channel' => function ($entry) {
         return get("/channels/{$entry['channel_id']}");
     }, 'meta' => function ($entry, $model) {
         return $model->get_meta($entry);
     });
     $this->search_fields = array('slug', 'name', 'title', 'content');
     // Indexes.
     $this->indexes = array('id' => 'unique', 'slug, channel_id' => 'unique');
     // Validate.
     $this->validate = array('required' => array('slug', 'channel_id'), 'unique' => array('slug'));
     // Query defaults.
     $this->query = array('order' => 'date_created DESC', 'limit' => 100);
     // Event binds.
     $this->binds = array('GET' => function ($event) {
         $data =& $event['data'];
         // Get by channel ID or slug.
         if ($data['channel']) {
             if ($channel = get("/channels/{$data['channel']}")) {
                 $data['channel_id'] = $channel['id'];
                 unset($data['channel']);
             } else {
                 // Channel not found.
                 return false;
             }
         }
     }, 'POST' => function ($event) {
         $data =& $event['data'];
         // Default slug.
         if (empty($data['slug'])) {
             if (isset($data['slug']) && ($name = $data['name'] ?: $data['title'])) {
                 $data['slug'] = hyphenate($name);
             } else {
                 $data['slug'] = $data['id'] ?: md5(microtime());
             }
         }
     }, 'PUT' => function ($event, $model) {
         $data =& $event['data'];
         // Version this entry?
         if ($data[':version'] && ($entry = get("/entries/{$event['id']}"))) {
             if ($data[':version'] != $entry['date_updated']) {
                 $ver_by = $data['version_by'];
                 $conflicts = $entry['version_conflicts'];
                 // Check diff with channel fields.
                 foreach ((array) $entry['channel']['fields'] as $field) {
                     $field_id = $field['id'];
                     if (isset($data[$field_id]) && isset($entry[$field_id]) && $data[$field_id] != $entry[$field_id]) {
                         $conflicts[$ver_by][$field_id]['yours'] = $data[$field_id];
                         $conflicts[$ver_by][$field_id]['theirs'] = $entry[$field_id];
                     }
                 }
                 // Used to resolve stacking conflicts.
                 $conflicts[$ver_by]['version_by']['theirs'] = $entry['version_by'];
                 $conflicts[$ver_by]['date_updated']['theirs'] = $entry['date_updated'];
                 if ($conflicts) {
                     put($entry, array('version_conflicts' => $conflicts, 'date_updated' => $entry['date_updated']));
                     return false;
                 }
             }
         }
     }, 'PUT, POST' => function ($event) {
         $data =& $event['data'];
         // Set entry channel?
         if (isset($data['channel'])) {
             $channel = get("/channels/{$data['channel']}");
             $data['channel_id'] = $channel['id'];
             unset($data['channel']);
         }
     });
 }
开发者ID:kfuchs,项目名称:fwdcommerce,代码行数:75,代码来源:Entries.php


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